我按照以下步骤在 Sublime Text 3 上运行 Python 3。
选择菜单“工具”>“构建”>“新建构建系统”,我输入了以下内容:
{
"cmd": ["python3", "$file"]
, "selector": "source.python"
, "file_regex": "file \"(...*?)\", line ([0-9]+)"
}
之后,我将其保存到以下(特定于 Mac)目录:~/Library/Application Support/Sublime Text 3/Packages/User
但是当我尝试在 Sublime 中的 Python 3 上运行我的代码时,出现此错误:
[Errno 2] No such file or directory: 'python3'
您需要提供 python3 的完整路径,因为 Sublime Text 不会读取您的~/.bash_profile
文件。打开终端,输入which python3
,并使用该完整路径:
{
"cmd": ["path/to/python3", "$file"],
"selector": "source.python",
"file_regex": "file \"(...*?)\", line ([0-9]+)"
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)