How does one install virtualenvwrapper
for both Python 2.7
and 3.6
versions? My default Python environment is Python 3.6
and as such virtualenvwrapper
is installed for Python 3.6
and not 2.7
. I'm using macOS Sierra 10.12.6
.
Virtual environments in Python 2To install virtualenv, just use pip install virtualenv . To create a virtual environment directory with it, type virtualenv /path/to/directory .
Create the virtual environment while you specify the version of Python you wish to use. The following command creates a virtualenv named 'venv' and uses the -p flag to specify the full path to the Python3 version you just installed: You can name the virtualenv anything you like. Installing setuptools, pip, wheel...
Yes you can . But, you need to set different environment variables for each of the version. If you don't want to do this,install anaconda distribution of python and create virtual env for different versions.
You need only install virtualenvwrapper
once. See the warning about installing on your base Python installation.
Using Homebrew package manager install python2
and python3
.
Making a virtual environment is a matter of passing a flag.
# make py3
mkvirtualenv py3 --python=python3
# make py2
mkvirtualenv py2 --python=python2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With