I am using python 2.7 + virtualenv version 1.10.1 for running myproject projects. Due to some other projects requirement I have to work wit
virtualenv is the tool of choice for Python 2, while venv handles the task in Python 3.
Yet you can create the virtual environment for Python 3 using any of them.
venv
python3 -m venv virtualenvname
Command Syntax:
/path/to/python3 -m venv /path/to/directory/virtual_env_name
virtualenv
virtualenv -p python3 virtualenvname
Command Syntax:
virtualenv -p /path/to/python3 /path/to/directory/virtual_env_name
On Linux, Unix or MacOS, using the terminal or bash shell:
source /path/to/venv/bin/activate
e.g. source virtualenvname/bin/activate
On Unix or MacOS, using the csh shell:
source /path/to/venv/bin/activate.csh
On Unix or MacOS, using the fish shell:
source /path/to/venv/bin/activate.fish
On Windows using the Command Prompt:
path\to\venv\Scripts\activate.bat
On Windows using PowerShell:
path\to\venv\Scripts\Activate.ps1
On Linux, Unix or MacOS, using the terminal or bash shell:
deactivate
On Windows using the Command Prompt:
path\to\venv\Scripts\deactivate.bat
On Windows using PowerShell:
deactivate
This answer is for those who may use a different OS.