Pip Cheatsheet

kuniga.me > Docs > Pip Cheatsheet

Pip Cheatsheet

Index

  1. Setup
    1. PYTHONPATH
    2. Install in different directory

Setup

PYTHONPATH

The directory where pip installs packages is based on PYTHONPATH, so make sure it’s the same one Python reads from (e.g. in Jupyter).

export PYTHONPATH="~/homebrew/lib/python3.9/site-packages/:$PATH"

Install in different directory

If pip finds a package in one of the directories listed in PYTHONPATH, it will not download it.

You can see where a package is installed via:

pip3 show <package> | grep Location

To specify the directory:

pip3 install --target=<path> <package>