Issue
I tried the method suggested here for installing virtualenv. However, it gives a confusing error on Ubuntu 16:
% /usr/bin/python2.7 -m pip install virtualenv
Collecting virtualenv
Using cached https://files.pythonhosted.org/packages/94/d7/adb787076e65dc99ef057e0118e25becf80dd05233ef4c86f07aa35f6492/virtualenv-20.25.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-toC2d7/virtualenv/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-toC2d7/virtualenv/
I already have some virtualenv installed; I tried removing it as suggested here but that also doesn't work:
% pip uninstall virtualenv
Cannot uninstall requirement virtualenv, not installed
How can I install virtualenv for Python 2.7?
Solution
There is no need to install virtualenv
. It is just a script. Download the Python 2.7 version as follows:
git clone https://github.com/pypa/virtualenv.git virtualenv
(cd virtualenv ; git checkout -b 13.1.2 13.1.2)
(Later versions might work, but they rely on newer pip
s that spew warnings critiquing Python 2.7).
Then you can create an environment env
using the following command:
/usr/bin/python2.7 virtualenv/virtualenv.py env
Answered By - personal_cloud Answer Checked By - Marie Seifert (WPSolving Admin)