PIP: Python's Package Manager

ongoing note

15 Sep 2022

install location

where

determine pip's install location:

where pip

(venv) xxx@yyy notes % where pip
/Users/xxxx/Python/homee/venv/bin/pip
/Users/xxxx/Library/Python/3.8/bin/pip
  • why 2 paths? 🤔

which

which pip

(venv) nic@NicolasacStudio notes % which pip
/Users/xxxx/Python/homee/venv/bin/pip

get list of all libraries/packages installed

pip3 freeze > requirements.txt

good habit to run this regularly to ensure up-to-date package list in case of issue. Experience! 😅

with open("requirements.txt") as myFile:
  pkgs = myFile.read()
  pkgs = pkgs.splitlines()

  for pkg in pkgs:
      print(pkg.split('==')[0])

re-install all:

pip3 install -r requirements.txt

troubleshooting

python3 -m ensurepip

and

python3 -m pip install --upgrade pip

links

social