19 Mai

Python | Advanced – Working with Virtualenv

Create a virtual environment

# Python 2
$ virtualenv venv2 --python /usr/local/bin/python2.7

# Python 3
$ virtualenv venv3 --python /usr/local/bin/python3.7

Activate desired python version

# Python 2
$  . venv2/bin/activate

# Python 3
$  . venv3/bin/activate