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..
我一直在自学python,并开始使用python 2.7.5和崇高的文本2。我最近注册了一个类,他们正在使用python 3.4。我下载并安装了python 3.4到我的mac上,但是我不知道如何使用python 3而不是2.7来制作优秀的文本。我用. .
import sys
print sys.version
to determine which version of python ST was using. It reports back with 2.7.5.
以确定使用哪个版本的python。它的报告是2.7.5。
How do I force ST to use python 3?
如何强制ST使用python 3?
If I have not included enough information, please don't hesitate to ask.
如果我没有提供足够的信息,请尽管问。
1 个解决方案
#1
12
Found this on Google.
在谷歌上发现了这个。
Create the file ~/.config/sublime-text-2/Packages/Python/Python3.sublime-build
:
创建文件~ / config / sublime-text-2 /包/ Python / Python3.sublime-build:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
You should then be able to choose the Python3 build system.
您应该能够选择Python3构建系统。
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/"
}
#1
12
Found this on Google.
在谷歌上发现了这个。
Create the file ~/.config/sublime-text-2/Packages/Python/Python3.sublime-build
:
创建文件~ / config / sublime-text-2 /包/ Python / Python3.sublime-build:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
You should then be able to choose the Python3 build system.
您应该能够选择Python3构建系统。
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/"
}