Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install virtualenvwrapper for Python 2.7 and 3.6 simultaneously

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.

like image 481
user20112015 Avatar asked Aug 28 '17 11:08

user20112015


People also ask

How do I enable virtual environment in Python 2?

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 .

How do I install a specific version of a Python in a virtual environment?

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...

Can you have Python 2 and 3 at the same time?

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.


1 Answers

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
like image 196
Oluwafemi Sule Avatar answered Oct 28 '22 21:10

Oluwafemi Sule