Sublime Text 3 上的 Python 3.4 [英] Python 3.4 on Sublime Text 3
问题描述
我按照以下步骤在 Sublime Text 3 上运行 Python 3.
I followed these steps to run Python 3 on Sublime Text 3.
选择菜单工具">构建">新建构建系统",然后输入以下内容:
Select the menu Tools > Build > New Build System and I entered the following:
{
"cmd": ["python3", "$file"]
, "selector": "source.python"
, "file_regex": "file \"(...*?)\", line ([0-9]+)"
}
之后,我将其保存到以下(Mac 特定的)目录:~/Library/Application Support/Sublime Text 3/Packages/User
After that, I saved it to the following (Mac-specific) directory: ~/Library/Application Support/Sublime Text 3/Packages/User
但是当我尝试在 Sublime 中的 Python 3 上运行我的代码时出现此错误:
but I'm getting this error when I'm trying to run my code on Python 3 in Sublime:
[Errno 2] No such file or directory: 'python3'
推荐答案
您需要提供 python3 的完整路径,因为 Sublime Text 不会读取您的 ~/.bash_profile
文件.打开终端,输入 which python3
,然后使用完整路径:
You need to provide the full path to python3, since Sublime Text does not read your ~/.bash_profile
file. Open up Terminal, type which python3
, and use that full path:
{
"cmd": ["path/to/python3", "$file"],
"selector": "source.python",
"file_regex": "file \"(...*?)\", line ([0-9]+)"
}
这篇关于Sublime Text 3 上的 Python 3.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!