Overview
Python uses a package management system called “pip“. Package management is available on newer hosting platforms v4.5 and above. Terminal access is necessary to use the feature.
Package management
All packages installed reside under /usr/local/lib/python/<VERSION> where <VERSION> is the Python version. Python versions may be switched on-the-fly using pyenv on v6 platforms.
Important platform info: all commands listed here use pip
. On older platforms, pre-v6, use pip-python
instead of pip
to install packages. Syntax remains otherwise the same.
Installing packages
Use pip-python install PKGNAME
where PKGNAME is a package name listed in Python Package Index.
To install Django: pip install django
To install a Python 2.6+ package to your home directory, specify --user
:
pip install --user django
The package, django, will be installed under ~/.local/lib/
.
Listing packages
To view packages locally installed, issue pip-python list. To view remote packages using basic string matching, use pip-python search PKGTOKEN
, where PKGTOKEN is a partial package name to search for. You may wish to page long content by piping output to less as in pip-python search PKGTOKEN | less
:
Removing packages
pip-python uninstall PKGNAME
where PKGNAME is a package installed and listed via pip-python list
.
Upgrading packages
pip-python install --upgrade PKGNAME
where PKGNAME is the package installed and listed via pip-python list
.