'Using two different Python Distributions

I currently have continuum analytics' Python distribution (called Anaconda) downloaded and in use on my computer. My problem is that I want to use virtualenv for a flask project and Anaconda flashes a warning that says "virtual env is not supported".

Is there any way I can run two distributions, stock Python and Anaconda on the same computer?



Solution 1:[1]

What about using a version manager like pyenv?

Once installed, you can use it to install multiple python versions:

pyenv install 2.7.16
pyenv install anaconda-1.8.0

Then switch to a specific version locally or globally:

pyenv global 2.7.16

This blog has more details on this approach.

Solution 2:[2]

I guess the python is the same. What different is packages.

I use root lib of anaconda. I create ANACONDA=/path/to/anaconda environment variable and use anaconda packages if the variable is defined:

# if You want to run the script in anaconda - export ANACONDA=/path/to/anaconda
import os
try:
    os.environ["ANACONDA"]
    sys.path.insert(1, os.environ["ANACONDA"] + "/lib/python2.7/site-packages")
except KeyError:
    pass

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ahmad Abdelghany
Solution 2 Adobe