virtualenv python version code example

Example 1: python virtual env

$ pip install virtualenv

Example 2: python env

python3 -m venv tutorial-env
tutorial-env\Scripts\activate.bat (window)
source tutorial-env/bin/activate (linux)

Example 3: python virtual env

$ virtualenv --version

Example 4: virtualenv specify python version

virtualenv --python=/usr/bin/python2.6 <path/to/new/virtualenv/>

Example 5: python virtual env

$ source venv/bin/activate

Example 6: start virtualenv with python version

python3 -m venv <myenvname>