tips
9 tips Pip
One command, setting or habit at a time about Pip: what it does, the line to copy and a caveat or two.
Installing packages 6
-
Limit which version a dependency may get, without adding it to the project.
urllib3<2 -
Fetch packages and dependencies on one machine and install them on another.
python3 -m pip download -r requirements.txt -d ./wheels -
See available versions of a package before you pin or downgrade.
python3 -m pip index versions requests -
Pin each package to a file hash so a swapped download fails.
python3 -m pip download requests==X.Y.Z --no-deps -d ./pkgs -
Fail fast instead of compiling when no prebuilt wheel exists.
python3 -m pip install --only-binary=:all: numpy -
Install a fix that isn't released yet, pinned to an exact point.
python3 -m pip install "git+https://example.com/team/[email protected]"
Environments 2
-
Write pip settings to a config file and check which file holds them.
python3 -m pip config set global.timeout 60 -
Makes pip refuse to install packages unless a virtual environment is active.
export PIP_REQUIRE_VIRTUALENV=true
Python one-liners 1
-
Lists the packages pip would install, without installing or changing anything.
python3 -m pip install --dry-run requests
Nothing in this filter yet.