简体   繁体   中英

Why does Sublime Text 3 give me a “python: command not found” error

I am getting an error "

[Finished in 0.0s with exit code 127] [shell_cmd: python -u "/bin/apturl-gtk"] [dir: /usr/bin] [path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin]bash: python: command not found

I have python 3.7 installed, and am running Ubuntu. What do I do?

i am assuming the problem resembels the below image and the solution for ubuntu: go to tools> build system> new build system, then put the below code to that popped up file and save it,put the location of python installation instead of "python3" if you use ubuntu then no need to add the whole path(as it is installed by default)just write as below { "cmd": ["python3", "-i", "-u", "$file"], "file_regex": "^[ ]File \"(...?)\", line ([0-9]*)", "selector": "source.python" } after saving the file now go to tools>build system then python3 will be noticeable and check the box of python3.Now save any file with py extension in sublime containing these two lines of python code to test the version import sys and then print(sys.version) and run by going tools>build.Hope it will work as it worked for me.thanks在此处输入图像描述

Since Ubuntu Bionic, Python 2 is no longer installed by default.

Besides, https://www.python.org/dev/peps/pep-0394/ now discourages the use of unqualified python (by leaving it up to distro maintainers whether to provide it at all and which version to link it to) to ease up the migration to Py3, so you can raise that as an issue with the developers of the program.

Try below commands if you are using the Ubuntu 18.04 version

sudo apt update
sudo apt -y upgrade

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM