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

# for windows 10

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

Example 3: activate venv

source env/bin/activate

Example 4: how to activate venv python

python3 -m venv tutorial-env

Example 5: how to activate venv python

tutorial-env\Scripts\activate.bat

Example 6: how to activate venv python

(tutorial-env) $ python -m pip install -r requirements.txt
Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))
  ...
Collecting numpy==1.9.2 (from -r requirements.txt (line 2))
  ...
Collecting requests==2.7.0 (from -r requirements.txt (line 3))
  ...
Installing collected packages: novas, numpy, requests
  Running setup.py install for novas
Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0