how to activate environment python 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: activate venv

source env/bin/activate

Example 3: create a virtual environment python 3

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

Example 4: start virtualenv

source env/bin/activate

Example 5: how to activate venv python

python3 -m venv tutorial-env

Example 6: activate venv in python

(tutorial-env) $ pip freeze > requirements.txt
(tutorial-env) $ cat requirements.txt
novas==3.1.1.3
numpy==1.9.2
requests==2.7.0

Tags:

Misc Example