what is virtualenv code example

Example 1: virtual env create python

#------FOR LINUX/MAC---------#
#installing venv 
sudo apt-get install python3.6-venv
#creating virtual env
python3 -m venv env
#activating virtual env
source env/bin/activate


#-------FOR WINDOWS----------#
#installing venv
py -m pip install --user virtualenv
#creating virtual env
py -m venv env
#activating virtual env
.\env\Scripts\activate

Example 2: python venv usage

python3 -m venv /path/to/new/virtual/environment

Example 3: virtualenv

pip install virtualenv

Example 4: virtualenv

virtualenv env

Example 5: virtualenv

source env/bin/activate          ## for mac usersenv\Scripts\activate\            ## for windows user"""You can deactivate your environment at any time with the deactivate command.activate"""

Example 6: virtualenv

virtualenv env
env\Scripts\activate
deactivate env