简体   繁体   English

SublimeREPL FileNotFoundError(2, "没有这样的文件或目录:'python'")

[英]SublimeREPL FileNotFoundError(2, "No such file or directory: 'python'")

I'm new to linux and I've just started using Ubuntu 20.04 LTS to get a feel for it.我是 linux 的新手,我刚刚开始使用 Ubuntu 20.04 LTS 来感受一下。

I installed the snap version of Sublime Text 3 from the software centre included and set it up like I would usually do on Windows (Install package installer, download a theme and then download SublimeREPL).我从包含的软件中心安装了 Sublime Text 3 的 snap 版本,并像我通常在 Windows 上一样进行设置(安装 package 安装程序,下载主题,然后下载 SublimeREPL)。

However, when I try to run it I always get the error但是,当我尝试运行它时,我总是得到错误

FileNotFoundError(2, "No such file or directory: 'python'")".

I looked to see if Python was installed and which one.我查看是否安装了 Python 以及哪一个。 I had Python 3.8.2 installed so I then proceeded to update it 3.8.4.我安装了 Python 3.8.2,然后我继续更新它 3.8.4。

I then tried again to see if it worked but it still doesn't work.然后我再次尝试查看它是否有效,但它仍然无效。

How can I fix this?我怎样才能解决这个问题?

Thanks,谢谢,

Mr Purple紫先生

I recently also faced this problem.我最近也遇到了这个问题。 For any future users who also run into this, here's what I did:对于也遇到此问题的任何未来用户,这就是我所做的:

open: home/username/.config/sublime-text-3/Packages/SublimeREPL/config/Python打开:home/username/.config/sublime-text-3/Packages/SublimeREPL/config/Python

From here open Main.sublime-menu.从这里打开 Main.sublime-menu。 Edit the entries so that it is the same as this: https://gist.github.com/Hckmar9/e1cb87b67a9836db4d26#file-main-sublime-menu编辑条目,使其与以下内容相同: https://gist.github.com/Hckmar9/e1cb87b67a9836db4d26#file-main-sublime-menu

All you need to do really is change python to python3 a few times in the file.您真正需要做的就是在文件中将 python 更改为 python3 几次。 Once you're done, save and close.完成后,保存并关闭。 Now try again on sublime and it should work fine.现在在 sublime 上再试一次,它应该可以正常工作。

With installing python3, the command that can be used for running python scripts is $python3 <script_path>.安装 python3 后,可用于运行 python 脚本的命令是$python3 <script_path>.

If you look at sublimeREPL config file for python, you will see that it uses "python" command instead of "python3" and because of this, you have gotten that error.如果你查看 python 的 sublimeREPL 配置文件,你会看到它使用“python”命令而不是“python3”,因此,你得到了那个错误。 To solve this problem, you can use update-alternative command in linux to link "python" string to "python3".为了解决这个问题,您可以使用 linux 中的update-alternative命令将“python”字符串链接到“python3”。 To do that, you can copy and paste the following command in your shell:为此,您可以将以下命令复制并粘贴到 shell 中:

sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python:FileNotFoundError:[Errno 2]没有这样的文件或目录 - python: FileNotFoundError: [Errno 2] No such file or directory Python FileNotFoundError:[错误2]没有这样的文件或目录 - Python FileNotFoundError: [Errno 2] No such file or directory Python FileNotFoundError: [Errno 2] 没有这样的文件或目录: - Python FileNotFoundError: [Errno 2] No such file or directory: Python 3-FileNotFoundError:[Errno 2]没有这样的文件或目录 - Python 3 - FileNotFoundError: [Errno 2] No such file or directory FIleNotFoundError:没有这样的文件或目录 Ubuntu Python - FIleNotFoundError: No such file or Directory Ubuntu Python 启动SublimeREPL -python时,发生“没有这样的文件或目录”错误 - “ No such file or directory” error happens when start SublimeREPL -python python:IOError:[Errno 2]使用sublimeREPL时没有此类文件或目录 - python: IOError: [Errno 2] No such file or directory when use sublimeREPL FileNotFoundError: [Errno 2] 没有这样的文件或目录 Azure Python 错误 - FileNotFoundError: [Errno 2] No such file or directory Azure Python error Python 错误:FileNotFoundError: [Errno 2] 没有那个文件或目录 - Python error: FileNotFoundError: [Errno 2] No such file or directory python_pygame - FileNotFoundError:没有这样的文件或目录 - python_pygame - FileNotFoundError: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM