简体   繁体   中英

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. I also have Python 3.5 installed and added the following to my .bachrc file:

alias python=/usr/bin/python3.5

I run python -V and it indicates 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?

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. Try this

cat $(which pip)

You probably have a pip3.5 program, and you can alias it like this

alias pip=/usr/bin/pip3.5

Otherwise you can always run pip like this

python3.5 -m pip install <package>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM