[英]bad interpreter: No such file or directory when running pip
Whenever I try to run pip (with or without any of the options) I get something like this:每当我尝试运行 pip (有或没有任何选项)时,我都会得到这样的结果:
$ pip --version
/usr/local/Cellar/pyenv/1.2.16/pyenv.d/exec/pip-rehash/pip: /Library/Frameworks/Python.framework/Versions/3.7/bin/pip: /usr/local/bin/python3: bad interpreter: No such file or directory
Running which pip
however, returns me /Users/jalee/.pyenv/shims/pip
which is an expected behaviour.然而,运行which pip
返回/Users/jalee/.pyenv/shims/pip
这是预期的行为。
Not sure why this is happening不知道为什么会这样
python3 -c "print('working')" python3 -c "打印('工作')"
print working
just fine打印working
正常
I solved this problem by using pip
instead of pip3
.我通过使用pip
而不是pip3
解决了这个问题。
"bad interpreter: No such file or directory" “错误的解释器:没有这样的文件或目录”
seems to mean that a wrong (not bad) interpreter is being used to interpret a Python file.似乎意味着使用错误(不错)的解释器来解释 Python 文件。
In my case, it seems that I was trying to install a Python 2 program with a Python 3 installer.就我而言,似乎我试图用 Python 3 安装程序安装 Python 2 程序。 In your case, it looks like you are trying to use a Python 2 version of pip, which processes Python 2 files, to install a Python 3 file.在您的情况下,您似乎正在尝试使用 Python 2 版本的 pip(它处理 Python 2 文件)来安装 Python 3 文件。
Your submission indicates that your pip (which may be intended for Python 2) is associated with a Python 3 interpreter.您提交的内容表明您的 pip(可能适用于 Python 2)与 Python 3 解释器相关联。 Perhaps you might try uninstalling pip then reinstall it making sure that you get the Python 3 version.也许您可以尝试卸载 pip 然后重新安装它以确保您获得 Python 3 版本。
I am currently using miniconda 3 which provides both pip
and pip3
.我目前正在使用 miniconda 3,它提供pip
和pip3
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.