pip flags & options

-r, --requirement

Install packages from a requirements file.

pip install -r requirements.txt

--user

Install to the user's home directory instead of system-wide.

pip install --user requests

-U, --upgrade

Upgrade a package to the latest version.

pip install -U pip
pip install --upgrade requests

--no-cache-dir

Disable the cache. Useful in Docker builds to save image size.

pip install --no-cache-dir -r requirements.txt

--index-url, -i

Use a custom package index URL.

pip install --index-url https://pypi.example.com/simple/ mypackage

-e, --editable

Install a package in editable/development mode (links to source).

pip install -e .
pip install -e ./my-library

--target, -t

Install packages into a specific directory.

pip install --target ./libs requests

--constraint, -c

Constrain package versions using a constraints file.

pip install -r requirements.txt -c constraints.txt

--no-deps

Don't install package dependencies.

pip install --no-deps mypackage

--pre

Include pre-release and development versions.

pip install --pre mypackage

freeze

Output installed packages in requirements format.

pip freeze > requirements.txt

list --outdated

Show packages that have newer versions available.

pip list --outdated