python venv setup code example

Example 1: how to create a python venv

python3 -m venv tutorial-env

Example 2: create a venv

# Create the virtual environment.
python -m venv venv

# Activate the env.
venv\Scripts\activate.bat

Example 3: create a virtualenv python

pip install virtualenv
cd projectfolder #go to project folder
virtualenv projectname #create the folder projectname 
source projectname/bin/activate

Example 4: how to use virtual environment python

python3 -m pip install --user virtualenv

Example 5: how to activate venv python

python3 -m venv tutorial-env

Example 6: create a venv

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