0

I currently have Python 2.7 and 3.6 installed locally. I installed virtualenv and virtualenvwrapper with pip3. When I do not specify the the python version (i.e. $ mkvirtualenv hello) everything goes smoothly and I get the following output:

"Using base prefix '/home/rishi_gurnani/python' New python executable in /home/rishi_gurnani/.virtualenvs/hello/bin/python3.6 Also creating executable in /home/rishi_gurnani/.virtualenvs/hello/bin/python Installing setuptools, pip, wheel...done. virtualenvwrapper.user_scripts creating /home/rishi_gurnani/.virtualenvs/hello/bin/predeactivate virtualenvwrapper.user_scripts creating /home/rishi_gurnani/.virtualenvs/hello/bin/postdeactivate virtualenvwrapper.user_scripts creating /home/rishi_gurnani/.virtualenvs/hello/bin/preactivate virtualenvwrapper.user_scripts creating /home/rishi_gurnani/.virtualenvs/hello/bin/postactivate virtualenvwrapper.user_scripts creating /home/rishi_gurnani/.virtualenvs/hello/bin/get_env_details"

However, when I specify that I want python2.7 (i.e. $ mkvirtualenv -p python2.7 hello2) I get:

"Running virtualenv with interpreter /home/rishi_gurnani/python/bin/python2.7"

So no virtualenv is being created anywhere. In other words, I'm only able to create a virtualenv with Python 3.6. but I would also like to create one which uses 2.7 instead.

rgurnani
  • 25
  • 1
  • 5

1 Answers1

0

A question like yours has already been asked. You would want to refer to this: Can't Find or create a new virtualenv

Make sure that your virtualenv version installed is the one suitable for Python 2.7. As far as I know pip3 is only for Python3.

bharat nc
  • 129
  • 2
  • 7
  • Yes, when I type "python2.7 -m pip list" virtualenv is not there but it is when I type "python3.6 -m pip list". The only way I can install pip from source is with python3, when I try with python2.7 it errors out so I'm not sure how to get the correct version of pip so that the modules can be found by the command "python2.7 -m pip list" – rgurnani Jun 05 '18 at 23:16
  • > when I try with python2.7 it errors out. What is the error that you get? Also,try creating a virtualenv with this command: "virtualenv -p /usr/bin/python2.7 " (assuming you are in some version of Linux) – bharat nc Jun 06 '18 at 18:42
  • my Python 3 is `python3` in my current system, so I modified `virtualenvwrapper.sh` by changing `python` to `python3` in three places. otherwise I was unable to create a virtual env. after 2020, that issue should come up less often. – noobninja Oct 15 '19 at 04:55