How to create virtual env with python3

To create virtual env

virtualenv -p python3 venv_name 

This will create new python executable in baseDirectory/bin/python3

How to activate newely created Venv:

cd baseDirectory/bin/  

source activate  

Deactivate new venv

deactivate 

UPDATE_1

This method has been depreciated as The use of venv is now recommended for creating virtual environments. Please check this link for updated answer


In Python 3.6+, the pyvenv module is deprecated. Use the following one-liner instead:

python3 -m venv <myenvname>

This is the recommended way to create virtual environments by the Python community.