-bash: /usr/local/bin/python: 没有那个文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38883034/
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-09-18 15:02:24  来源:igfitidea点击:

-bash: /usr/local/bin/python: No such file or directory

bashpython-3.4virtualenvwrapper

提问by lena

When I run workon env1,

当我跑步时workon env1

-bash: /usr/local/bin/python: No such file or directory
-bash: /usr/local/bin/python: No such file or directory

displays (the same line twice). However, I am in env1, as it shows up in my command prompt. When I run which virtualenvwrapper.sh, I get

显示(同一行两次)。但是,我在 env1 中,因为它显示在我的命令提示符中。当我跑步时which virtualenvwrapper.sh,我得到

/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh

/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh

I saw another thread that said to run ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.shwhich gave me

我看到另一个线程说要运行ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.sh它给了我

ln: /usr/local/bin/virtualenvwrapper.sh: File exists

I installed the wrapper through sudo -H pip install virtualenvwrapper

我通过安装包装器 sudo -H pip install virtualenvwrapper

Not really sure where to go from here.

不太确定从这里去哪里。

回答by Christian Long

For me, there was a link in /usr/local/binto python2. I created another one, linking the same file to python.

对我来说,有一个链接/usr/local/binpython2. 我创建了另一个,将同一个文件链接到python.

$ cd /usr/local/bin

# The /usr/local/bin/python2 symlink exists already.
$ ls -al python2

lrwxr-xr-x 1 a_user a_group 37 Jul 26 09:54 /usr/local/bin/python2 -> ../Cellar/python/2.7.13_1/bin/python2

# Make a symlink for python. The path for the python2
# symlink on your system might be different from this
# example. Just use whatever path the python2 symlink
# is pointing to on your system.
$ ln -s ../Cellar/python/2.7.13_1/bin/python2 python

# Now the symlink exists at /usr/local/bin/python
$ ls -al python

lrwxr-xr-x 1 a_user a_group 37 Jul 26 14:29 python -> ../Cellar/python/2.7.13_1/bin/python2*