maphew

Installing and Upgrading pipx

September 29, 2023

Pipx is for installing python programs in their own virtual environment, so they behave like regular programs that can have independent python versions and depencies from other python programs. It's lighter weight and simpler than other routes to the same end, such as Anaconda.

General preference when choosing install method, you'll be happier:

OS package manager (e.g. winget) > pipx > condax > conda > pip.

 

Installing globally

We install the windows `py` python launcher, followed by python.org's official cpython distribution. Then we refresh the current shell environment so py is in PATH.

winget install --id Python.Launcher --exact --force
winget install python.python.3.12 --location c:\apps\python
refreshenv
py -0
where python
sudo setx /M PIPX_BIN_DIR C:\bin
sudo setx /M PIPX_HOME C:\apps\pipx
c:\apps\python\python.exe -m pip install pipx
refreshenv

 

Upgrading

You need to do this after you've upgraded your system (or your Python version). What you do is more or less:

# get rid of the shared venv
rm -rf ~/.local/pipx/shared
# get pipx to re-create it
pipx list
# have pipx fix all of your venvs
pipx reinstall-all

 From < https://pypa.github.io/pipx/installation/>

From < https://utcc.utoronto.ca/~cks/space/blog/python/PipxFixingPythonVersion>