Linux /usr/bin/env: python2: 没有那个文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11390206/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 13:44:46  来源:igfitidea点击:

/usr/bin/env: python2: No such file or directory

pythonlinuxubuntu

提问by murtaza52

I am trying to configure Python for my Emacs on Ubuntu, and I get the following error:

我正在尝试在 Ubuntu 上为我的 Emacs 配置 Python,但出现以下错误:

/usr/bin/env: python2: No such file or directory

Can someone help me with it? What can I do to resolve it?

有人可以帮我吗?我能做些什么来解决它?

采纳答案by glglgl

Probably that's just true. The link /usr/bin/python2 -> (the real one)should be provided by your Python package, but that's obviously not the case, nor on any other location where it can be found via the $PATH.

大概就是这样吧。该链接/usr/bin/python2 -> (the real one)应该由您的 Python 包提供,但显然不是这种情况,也不是可以通过$PATH.

You should put the said link in your path at the (an) appropriate place.

您应该将上述链接放在您的路径中(一个)适当的位置。

回答by ParaMeterz

Try this command in terminal

在终端中试试这个命令

sudo ln -s /usr/bin/python2.6 /usr/bin/python2

须藤 ln -s /usr/bin/python2.6 /usr/bin/python2

or

或者

sudo apt-get install python2

须藤 apt-get 安装 python2

回答by jfs

On Ubuntu 12.04.

在 Ubuntu 12.04 上。

To find out what package owns the file:

要找出哪个包拥有该文件:

$ apt-file -F find /usr/bin/python2
python-minimal: /usr/bin/python2

To find out what packages depend on the package:

要找出依赖包的包:

$ apt-cache rdepends python-minimal
python-minimal
Reverse Depends:
  python2.7-minimal
 |livecd-rootfs
  python-minimal:i386
  python-support
  python2.7-minimal
  python
 |livecd-rootfs

It show that if you have pythonpackage then you should have python-minimalpackage then you should have /usr/bin/python2file.

它表明,如果你有python包,那么你应该有python-minimal包,那么你应该有/usr/bin/python2文件。

Check whether /usr/binis in $PATHinside emacs. If it is and you can't run /usr/bin/python2from a shell then you could reinstall python-minimalto restore /usr/bin/python2file:

检查是否/usr/bin$PATHemacs里面。如果是这样并且您无法/usr/bin/python2从 shell运行,那么您可以重新安装python-minimal以恢复/usr/bin/python2文件:

$ sudo apt-get --reinstall install python-minimal