Pasted image 20240425122755.png

https://realpython.com/intro-to-pyenv/

Don't touch the system python version, use your own.

install pyenv:

{bash} curl https://pyenv.run | bash

for bash:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc

Install a python version with pyenv

pyenv install 3.11

Use that version

pyenv  global 3.11

other pyenv commands

pyenv versions

See all available pyenv versions

pyenv global

state what the current global pyenv version is.

pyenv shell

Debugging

I had pyenv break, that it did not properly set a new python version. Running {shell} eval "$(pyenv init -)" fixed it.