惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - Net66

LD_PRELOAD的偷梁换柱之能 ATOM & Sublime Text 下MarkDown插件功能比较 - Net66 存在 当爱已成往事 深秋 思想准备 不良习惯 人生三论 如今80后 人生九度 那15天以前...过去的年代。 JinSe 影响中国人的148句 早起看日出 乡土 传说的千年极“寒” 0912->1012 HOW HE/SHE'S SEEN 宿醉
Ubuntu 16.04下指定Sublime Text 3 默认python编译版本 - Net66
Net66 · 2016-06-19 · via 博客园 - Net66

安装PackageResourceViewer插件

  • 输入 Ctrl+Shift+P
  • 输入install,选择Package Control: Install Package
  • 选择PackageResourceViewer,安装

设置默认的 Python.sublime-build

  • 输入 Ctrl+Shift+P
  • 输入 resource,选择PackageResourceViewer:Open Resource
  • 再选择Python,再再选择Python.sublime-build
  • 编辑Python.sublime-build"shell_cmd": "python -u \"$file\"",改为以下之一:
  • "shell_cmd": "python3 -u \"$file\"", //指定python3为.py默认编译器
  • "shell_cmd": "python2 -u \"$file\"", //指定python2为.py默认编译器
  • "shell_cmd": "python -u \"$file\"", //根据Ubuntu系统设置,看/usr/bin/python链接哪儿(ln)
  • "shell_cmd": "指定版本python的绝对路径 -u \"$file\"", //指定路径下的python编译器
  • 使用python3的配置文件示例(Python.sublime-build)
{
	//"shell_cmd": "python -u \"$file\"",
	"shell_cmd": "python3 -u \"$file\"",                           //指定python3为.py默认编译器
	"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
	"selector": "source.python",

	"env": {"PYTHONIOENCODING": "utf-8"},

	"variants":
	[
		{
			"name": "Syntax Check",
			"shell_cmd": "python -m py_compile \"${file}\"",
		}
	]
}
  • Ctrl+S 保存配置文件
    注:有关.sublime-build 的配置信息说明,可见参见这儿
  • 重启Sublime Text 3
  • 打开.py文件,Ctrl + B 即可编译执行

呵呵,方便、顺眼多了

与其他方法的使用比较

网上也有其他变通方法,可以参考下面链接:

ubuntu下sublime text 3加入python3环境支持
指定ubuntu下的Python的运行版本

个人感觉:

  • 前者,每次编译时选择麻烦
  • 后者,改系统默认配置,可能引发其他依赖异常
  • 最后,本文方法Ctrl+B直接编译运行,又不改系统默认配置,对我最合适,简单、完美 😃