data_garden data_garden - 1 month ago 9
Python Question

Installing python 3 for a specific environment

I have

python 2.7.10
installed on my
mac
.

but I happen to need
Python 3
to use a
python wrapper
for a given
API
.

this is my folder structure:

apps/
myapp/
app.py
gracenote/
pygn.py


where
pygn.py
is the wrapper wich requires
Python 3
, while
app.py
requires
Python 2.7


is there a way to run an isolated
Python
environment for the
wrapper
?

Answer

You'll need to install both versions of python at the same time

$ which python3 # copy the output of this command $ mkvirtualenv --python=/path/to/python3 ~/.virtualenvs/{your env name} $ workon {your env name}