python virtual environment code example

Example 1: python virtual environment

python3 -m venv env
python -m virtualenv env #py2

source env/bin/activate

#all this is on same directory

Example 2: how to activate virtual environment in python

# for windows 10

py -m venv myvirtualenv
myvirtualenv\Scripts\activate #!!!! use "\" not "/" !!!!!

Example 3: virtual env in python

pip install --user virtualenv
py -m venv env
.\env\Scripts\activate

Example 4: create virtual environment python

sudo pip3 install virtualenv 

virtualenv venv

Example 5: python virtual environment

source env/bin/activate

Example 6: python virtual environment

python3 -m pip install --user virtualenv