mstrom
mstrom

Reputation: 1743

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.

Upvotes: 0

Views: 62

Answers (1)

Harald Nordgren
Harald Nordgren

Reputation: 12409

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>

Upvotes: 1

Related Questions