Tutorial by Examples

To install the latest version of a package named SomePackage: $ pip install SomePackage To install a specific version of a package: $ pip install SomePackage==1.0.4 To specify a minimum version to install for a package: $ pip install SomePackage>=1.0.4 If commands shows permission den...
To uninstall a package: $ pip uninstall SomePackage
To list installed packages: $ pip list # example output docutils (0.9.1) Jinja2 (2.6) Pygments (1.5) Sphinx (1.1.2) To list outdated packages, and show the latest version available: $ pip list --outdated # example output docutils (Current: 0.9.1 Latest: 0.10) Sphinx (Current: 1.1.2 Late...
Running $ pip install --upgrade SomePackage will upgrade package SomePackage and all its dependencies. Also, pip automatically removes older version of the package before upgrade. To upgrade pip itself, do $ pip install --upgrade pip on Unix or $ python -m pip install --upgrade pip on ...
pip doesn't current contain a flag to allow a user to update all outdated packages in one shot. However, this can be accomplished by piping commands together in a Linux environment: pip list --outdated --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U This command takes all pa...
pip doesn't current contain a flag to allow a user to update all outdated packages in one shot. However, this can be accomplished by piping commands together in a Windows environment: for /F "delims= " %i in ('pip list --outdated --local') do pip install -U %i This command takes all pa...
pip assists in creating requirements.txt files by providing the freeze option. pip freeze > requirements.txt This will save a list of all packages and their version installed on the system to a file named requirements.txt in the current folder.
pip assists in creating requirements.txt files by providing the freeze option. pip freeze --local > requirements.txt The --local parameter will only output a list of packages and versions that are installed locally to a virtualenv. Global packages will not be listed.
If you have both Python 3 and Python 2 installed, you can specify which version of Python you would like pip to use. This is useful when packages only support Python 2 or 3 or when you wish to test with both. If you want to install packages for Python 2, run either: pip install [package] or: p...
Many, pure python, packages are not yet available on the Python Package Index as wheels but still install fine. However, some packages on Windows give the dreaded vcvarsall.bat not found error. The problem is that the package that you are trying to install contains a C or C++ extension and is not c...

Page 1 of 1