I recently added Python to a new machine, and in the wrestling to get things working to work on something with Python, couldn’t find my
$ pip -version
command not found: pip
Try `python -h' for more information.
$ python --version
$ python -m pip --version
path/to/Python: No module named pip
Other searches say things like “install with Homebrew!” or other options but there’s a module as well called
ensurepip, which was not the first suggestion so I am writing this post in hopes it helps someone else. Note: This module was added in Python 3.4.
python -m ensurepip
This invocation will install pip if it is not already installed, but otherwise does nothing.
I had pip installed (because I could run
path/to/python3.9 -m pip install --upgrade pip 😐 ) but whatever this did, it helped! Now I can run regular
pip from the CLI 🙂