Installing python3 in a python2 virtual environment Installing python3 in a python2 virtual environment flask flask

Installing python3 in a python2 virtual environment


It's not recommended to mix multiple versions of Python. In fact, I don't think it's even possible.

Creating a new virtualenv isn't difficult at all:

  1. Get the list of modules in the current virtualenv

    source /path/to/current/bin/activatepip freeze > /tmp/requirements.txt
  2. Create a new virtualenv. Either change into a suitable directory before executing the virtualenv command or give a full path.

    deactivatevirtualenv -p python3 envname
  3. Install modules

    source envname/bin/activatepip install -r /tmp/requirements.txt

That's it.