virtualenv pip cheatsheet Mar
31
1
0

Virtualenv and pip install typically go together so I'm combining their cheatsheets. These are the commands I use the most. This is pasted here for quick reference.

# create new virtual environment
virtualenv <name>
virtualenv <name> --no-site-packages

# activate and deactivate virtualenv 
source <name>/bin/activate
deactivate
# pip install
pip install PACKAGE
pip install PACKAGE==VERSON
pip install PACKAGE>=VERSION
pip install PACKAGE --upgrade
pip install -r /path/to/requirements.txt

# pip uninstall
pip uninstall PACKAGE

# pip freeze
pip freeze > requirements.txt

# pip install tar bundle
pip install http://example.com/path/to/tar/package.tgz

# git
pip install -e git://github.com/user/MyProject.git#egg=MyProject
pip install -e git+http://git.myproject.org/MyProject/#egg=MyProject
pip install -e git+ssh://git@myproject.org/MyProject/#egg=MyProject

pip install -e git://git.myproject.org/MyProject.git@master#egg=MyProject
pip install -e git://git.myproject.org/MyProject.git@v1.0#egg=MyProject
pip install -e git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=MyProject

# mercurial
pip install -e hg+http://hg.myproject.org/MyProject/#egg=MyProject
pip install -e hg+https://hg.myproject.org/MyProject/#egg=MyProject
pip install -e hg+ssh://hg@myproject.org/MyProject/#egg=MyProject

pip install -e hg+http://hg.myproject.org/MyProject/@da39a3ee5e6b#egg=MyProject
pip install -e hg+http://hg.myproject.org/MyProject/@2019#egg=MyProject
pip install -e hg+http://hg.myproject.org/MyProject/@v1.0#egg=MyProject
pip install -e hg+http://hg.myproject.org/MyProject/@special_feature#egg=MyProject

# subversion
pip install -e svn+http://svn.myproject.org/svn/MyProject/trunk@2019#egg=MyProject

# bazaar
pip install -e bzr+http://bzr.myproject.org/MyProject/trunk/#egg=MyProject
pip install -e bzr+sftp://user@myproject.org/MyProject/trunk/#egg=MyProject
pip install -e bzr+ssh://user@myproject.org/MyProject/trunk/#egg=MyProject
pip install -e bzr+ftp://user@myproject.org/MyProject/trunk/#egg=MyProject

pip install -e bzr+https://bzr.myproject.org/MyProject/trunk/@2019#egg=MyProject
pip install -e bzr+http://bzr.myproject.org/MyProject/trunk/@v1.0#egg=MyProject
Bookmark and Share
blog comments powered by Disqus