[英]Unable to upgrade virtualenv with Python3.5 and Python2.7 on the same machine
Python 2.7 is the default version on my RHEL box. Python 2.7是我的RHEL盒上的默认版本。 I also have Python 3.5 installed and added the following to my .bachrc file:
我还安装了Python 3.5,并将以下内容添加到我的.bachrc文件中:
alias python=/usr/bin/python3.5
I run python -V
and it indicates 3.5. 我运行
python -V
,它表示3.5。 All good. 都好。
I then run: 然后,我运行:
pip install --upgrade virtualenv
I get the following error: 我收到以下错误:
No distributions at all found for virtualenv in /usr/local/lib/python2.7/site-packages
I'm wondering why 2.7 is still be referenced? 我想知道为什么仍要引用2.7?
Thanks. 谢谢。
If you look at the contents of pip
you will notice that it's just a Python script, and it has a shebang line ( #!
) pointing to your old python. 如果查看
pip
的内容,您会注意到它只是一个Python脚本,并且有一个指向您的旧python的shebang行( #!
)。 Try this 尝试这个
cat $(which pip)
You probably have a pip3.5
program, and you can alias it like this 您可能有一个
pip3.5
程序,您可以像这样对它进行别名
alias pip=/usr/bin/pip3.5
Otherwise you can always run pip like this 否则你总是可以像这样运行pip
python3.5 -m pip install <package>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.