1

I am on AWS Ec2 Amazon AMI. Trying to install virtualenv but PIP is set to use Python2.6

# pip -V && virtualenv --version
pip 9.0.1 from /usr/local/lib/python2.6/site-packages/pip-9.0.1-py2.6.egg (python 2.6)
bash: /usr/bin/virtualenv: No such file or directory

# python -V
Python 2.7.12

I tried uninstalling virtualenv and reinstalling it but no luck.

#pip install virtualenv
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Requirement already satisfied: virtualenv in /usr/local/lib/python2.6/site-packages

Here is the install directory:

# which pip
/usr/sbin/pip
# which python
/usr/bin/python
Vineet Jain
  • 1,515
  • 4
  • 21
  • 31
Maca
  • 1,659
  • 3
  • 18
  • 42
  • Does it really make a difference. You can specify `virtualenv --python=/usr/bin/python2.7 `. If you need to use 2.7 version then you can specify like this. – Varad Sep 07 '17 at 06:00

1 Answers1

1

1.python2.7 -m pip install virtualenv
Reference Python official document

2.You can Install virtualenv for any python interpreter and use for a different python interpreter like:-

sudo pip3 install virtualenv 

and then if you want to use python2.7 python interpreter then run following command to make virtualenv:-

virtualenv --python=/usr/bin/python2.7 virtualenv_name

NOTE :- python2.7 interpreter has to be present in /usr/bin/* folder
For more on above command see this answer

Vineet Jain
  • 1,515
  • 4
  • 21
  • 31
  • so I guess i need to python2.7 -m pip each time when I want to install things to 2.7? – Maca Sep 07 '17 at 06:12
  • @Maca If you want to change your default python interpreter to python2.7 then see [this](https://stackoverflow.com/a/19256389/6761181). – Vineet Jain Sep 07 '17 at 06:32