Cheatography
https://cheatography.com
How to set up and use a virtual python environment in Ubuntu
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Installation using setuptools and pip
Install Easy Setup |
|
or |
|
Install PIP |
sudo easy_install pip |
Turn on bash autocomplete for pip |
pip completion --bash >> ~/.bashrc |
Enable bash pip completion |
source ~/.bashrc |
install virtualenv and virtualenvwrapper
sudo pip install virtualenv
sudo pip install virtualenvwrapper
|
Setup virtualenv
export WORKON_HOME=~/.virtualenvs
mkdir $WORKON_HOME
echo "export WORKON_HOME=$WORKON_HOME" >> ~/.bashrc
|
Setup virtualenvwrapper
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
echo "export PIP_VIRTUALENV_BASE=$WORKON_HOME" >> ~/.bashrc
source ~/.bashrc
|
|
|
Use Virtualenv
Create blank env |
mkvirtualenv <virtual-environment-name> --no-site-packages |
Switch env |
workon <virtual-environment-name> |
Leave Virtual env |
deactivate |
Manually switch env |
<vm-folder>/bin/source activate |
Remove Env |
rmvirtualenv <virtual-environment> |
|