[英]Sublime Text 3 Python3 build not working?
I have just installed the latest version of Sublime Text 3 on my Linux Pop_.OS Computer but I cannot run a python file.我刚刚在我的 Linux Pop_.OS 计算机上安装了最新版本的 Sublime Text 3,但我无法运行 python 文件。
When I try to build the file with python with CTRL-B
it gives me an error in the logs...当我尝试使用带有
CTRL-B
的 python 构建文件时,它在日志中出现错误...
bash: python: command not found
[Finished in 0.0s with exit code 127]
[shell_cmd: python -u "/media/kevinapetrei/KEVIN USB/Files/Programming/Python Programs/Finished/HiLo Versions/HiLo-2.02/setup.py"]
[dir: /media/kevinapetrei/KEVIN USB/Files/Programming/Python Programs/Finished/HiLo Versions/HiLo-2.02]
[path: /app/utils/bin:/app/sublime_merge/bin:/app/bin:/usr/bin]
This is pretty weird because I installed a package on terminal which allows me to use command python
to run python3.这很奇怪,因为我在终端上安装了 package,它允许我使用命令
python
来运行 python3。 (In terminal I can still run files using command python
. (在终端中,我仍然可以使用命令
python
运行文件。
What is wrong?怎么了? Can I edit this to make it work somehow?
我可以编辑它以使其以某种方式工作吗?
You can create a new build system
for python3 on Linux if the built-in method is not working.如果内置方法不起作用,您可以在 Linux 上为 python3 创建一个新的
build system
。
First, open your terminal and write首先,打开你的终端并写
$ which python3
it will give you the location of python3它会给你python3的位置
/usr/bin/python3
Then in sublime text go to tools -> Build System -> New Build System
and paste below code in that file and change location of the python if it is in a different location:然后在崇高的文本 go 到
tools -> Build System -> New Build System
并将以下代码粘贴到该文件中并更改 python 的位置(如果它位于不同的位置):
{
"cmd": ["/usr/bin/python3", "-u", "$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python"
}
Now save it using anyname_you_want.sumblime-build
and open a python file then select tools -> Build System -> anyname_you_want
and run your python file.现在使用
anyname_you_want.sumblime-build
保存它并打开 python 文件,然后打开 select tools -> Build System -> anyname_you_want
并运行 python 文件。 It should work.它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.