pyenv shell 3.12
# or globally
pyenv global 3.12
stolen from: https://realpython.com/intro-to-pyenv/
by default pyenv installs to ~/.pyenv/versions
make sure linux brew paths are not in the PATH env var.
export PATH=$(echo "$PATH" | sed -e 's/:\/home\/linuxbrew\/\.linuxbrew\/sbin//g' -e 's/:\/home\/linuxbrew\/\.linuxbrew\/bin//g')
or alternatively (not tested)
brew install gdbm
or
brew unlink pkg-config
and while you are at it might as well remove windows paths that show up by default in WSL
export PATH=$(echo "$PATH" | sed -e 's/:[^:]*\/mnt\/c[^:]*//g')
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl
curl https://pyenv.run | bash
pyenv install --list | grep " 3\.*"
pyenv install -v 3.12
pyenv versions
pyenv shell 3.12
pyenv global 3.12
stolen from: https://hackersandslackers.com/multiple-python-versions-ubuntu-20-04/
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt upgrade
apt list | grep python3.x
sudo apt-get install <python-version>
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
update-alternatives --list python3
update-alternatives --config python3
sudo apt remove --purge python3-apt
sudo apt autoclean
sudo apt install python3-apt
sudo apt install python3.9-distutils
apt install python3-pip
sudo apt install python3.9-venv
sudo apt install python3.11-dev
- either setup dev env to use that version of python
- configure PATH env var to use version of python in brew
Haven't used this approach, but this is a link to some docs: https://github.com/pyenv/pyenv