如何设置使用哪个版本的python sublime文本 [英] How to set which version of python sublime text uses
问题描述
我一直在自学python,并开始使用python 2.7.5和Sublime Text2.我最近注册了一个班级,他们使用的是python 3.4.我已在我的Mac上下载并安装了python 3.4,但是在弄清楚如何使Sublime Text使用python 3而不是2.7时遇到麻烦.我用过..
I have been teaching myself python and started out using python 2.7.5 and Sublime Text 2. I recently enrolled in a class and they are using python 3.4. I downloaded and installed python 3.4 onto my mac, but am having trouble figuring out how to make Sublime Text use python 3 instead of 2.7. I used..
import sys
print sys.version
确定正在使用哪个版本的python ST.它以2.7.5返回.
to determine which version of python ST was using. It reports back with 2.7.5.
如何强制ST使用python 3?
How do I force ST to use python 3?
如果我没有提供足够的信息,请随时询问.
If I have not included enough information, please don't hesitate to ask.
推荐答案
Found this on Google.
创建文件~/.config/sublime-text-2/Packages/Python/Python3.sublime-build
:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
然后您应该能够选择Python3构建系统.
You should then be able to choose the Python3 build system.
If that doesn't work, try this:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "utf8",
"path": "/Library/Frameworks/Python.framework/Versions/3.3/bin/"
}
这篇关于如何设置使用哪个版本的python sublime文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!