Taking a new tack, we are going to use UV. This installs a new, global Python environment. It can easily be tweaked for other project and local environments.
Install uv via
curl -LsSf https://astral.sh/uv/install.sh | sh
Make a bash file, install_python.sh
:
#!/bin/bash
# This should be in the HOME directory
uv python install 3.12
uv venv
source .venv/bin/activate
# Change packages below as desired
uv pip install -r requirements.txt
Make it executable
chmod +x install_python.sh
Edit .zshrc
file, adding
alias venv="source $HOME/.venv/bin/activate"
alias py="source $HOME/.venv/bin/activate; python"
alias jl="source $HOME/.venv/bin/activate; jupyter lab"
alias jn="source $HOME/.venv/bin/activate; jupyter notebook"