Pip
CLI
tool
package manager
Pip is the official python package manager
- Installation
- Usually pip is installed with python automatically.
- Upgrade pip
-
python -m pip install --upgrade pip - Install packages
-
pip install SomePackage # latest version pip install SomePackage==1.0.4 # specific version pip install 'SomePackage>=1.0.4' # minimum version - Install from requirements file
-
pip install -r requirements.txt - Generate requirements file from installed packages
-
pip freeze > requirements.txt - List installed packages
-
pip list - List outdated installed packages
-
pip list --outdated - Get info on package
-
pip show SomePackage
Returns name, version, summary, home-page, license, dependencies, required-by and location in your file system.
Wheels
Wheel files (binaries) make the installation of pip packages faster.
- Install wheel
-
pip install wheel - Create pip wheel file from requirements
-
pip wheel --wheel-dir=/local/wheels -r requirements.txt - Install packages from local wheels directory
-
pip install --no-index --find-links=/local/wheels -r requirements.txt
Pipenv
Pipenv is the environment manager for pip.
- Install pipenv
-
pip install --user --upgrade pipenv - Istall packages in your environment
-
pipenv install -r requirements.txt - Run script in your environment
-
pipenv run python python_script.py