我想在Sublime Text 3上运行Python代码。这样做是为了运行需要用户输入的程序。
1-我安装了“ PackageResourceViewer”
2-在命令面板中,键入并选择“ PackageResourceViewer:打开资源”
3-然后我写了python,并在结果列表(Python)中选择了第一项
4-在弹出面板中,我选择了Python.sublime-build
5-打开的文件,我编写了以下代码行:
"shell_cmd": "python -u \"$file\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "utf-8"},
"variants":
[
{
"name": "Syntax Check",
"shell_cmd": "python -m py_compile \"${file}\"",
},
{
"name": "Run in console",
"osx":{
"shell_cmd": "xterm -hold -e python -u \"$file\""
}
}
]
}
我键入Shift-Cmd-B,选择Python并在终端上出现以下错误:
bash: xterm: command not found
[Finished in 0.2s with exit code 127]
[shell_cmd: xterm -hold -e python -u "/Users/kalebsamano/Desktop/Fun. Programacion/calculadora_ahorros.py"]
[dir: /Users/kalebsamano/Desktop/Fun. Programacion]
[path: /anaconda3/bin:/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
我正在使用MacOS