pip install virtualenv
# Creating a virtual env.
virtualenv myvirtualenv
# activating
source env/bin/activate
# on windows
.envScriptsactivate
# Ubuntu/Debian
apt-get install python3-venv
python3 -m venv .venv
source .venv/bin/activate
# python 2
python -m virtualenv env
python3 -m venv env # create env
source env/bin/activate # activate env
deactivate # deactivate env
rm -r env/ # delete env in Linux
pip freeze # show all packages installed
pip install -r requirements.txt # install all packages
pip freeze > requirements.txt # create automatically requirements.txt
#------FOR LINUX/MAC---------#
sudo apt-get install build-essential libssl-dev libffi-dev python-dev #installing requirements
sudo apt-get install -y python3-venv #installing venv
python3 -m venv env #creating virtual env
source env/bin/activate #activating virtual env
#-------FOR WINDOWS----------#
py -m pip install --user virtualenv #installing venv
py -m venv env #creating virtual env
.envScriptsactivate #activating virtual env
### install virtualenvwrapper ###
pip install virtualenvwrapper-win
### Add an environment variable WORKON_HOME to specify the path to store environments. By default, this is %USERPROFILE%Envs. ###
### ↓↓↓ use cmd or cmder (don't use ps terminal) for any of the following commands ↓↓↓ ###
### list venvs ###
lsvirtualenv
### create venv (automatically activated after creation) ###
mkvirtualenv <name>
### remove venv ###
rmvirtualenv <name>
### activate venv ###
workon <name>
### deactivate venv ###
deactivate
### General Syntax ###
mkvirtualenv [-a project_path] [-i package] [-r requirements_file] [virtualenv options] <name>
python -m venv my_env
source my_env/bin/activate
python -m venv my_env
python -m venv venv
virtualenv env
envScriptsactivate
deactivate env
sudo apt install python3-venv
python3 -m venv my-project-env
source my-project-env/bin/activate
python -m venv flask_env # Creating an isolated environment
source flask_env/bin/activate # Activate virtual environment
deactivate #deactivate
# installs PIP globally
curl https://bootstrap.pypa.io/get-pip.py | python
# installs virtualenv globally
pip install virtualenv
# creates a virtualenv
virtualenv -p python2.7 venv
# activates the virtualenv
source venv/bin/activate
# in terminal -
pip install virtualenv
virtualenv env # or any other name
envScriptsActivate
python3 -m venv tutorial-env
// start it
source tutorial-env/bin/activate
// end it
deactivate
source <folder-env>/bin/activate
pip install virtualenv env_name #creating env
source env_name/bin/activate #activate env
deactivate #closing/ deactivating env
virtualenv venv --system-site-packages
pip install virtualenvwrapper-win
#for installing virtualenv package
mkvirtualenv [mkvirtualenv-options] [virtualenv-options] <name>
#creating a virtualenv
workon <env name>
#using virtualenv
cd my-project/
virtualenv venv
pip install <package>