Skip to content

Instantly share code, notes, and snippets.

@seahrh
Created September 29, 2025 04:55
Show Gist options
  • Save seahrh/147aec12cc0e94b6090450457eb5190a to your computer and use it in GitHub Desktop.
Save seahrh/147aec12cc0e94b6090450457eb5190a to your computer and use it in GitHub Desktop.
Change python version with pyenv
curl https://pyenv.run | bash
# Load pyenv automatically by appending
# the following to
# ~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
# and ~/.bashrc (for interactive shells) :
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - bash)"
# Restart your shell for the changes to take effect.
# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:
eval "$(pyenv virtualenv-init -)"
source ~/.bashrc
pyenv --version
pyenv install 3.11.9
Above command gave the following errors:
Fix the following errors:
E: Unable to locate package libreadline-dev
E: Unable to locate package libsqlite3-dev
E: Unable to locate package libncurses-dev
E: Unable to locate package tk-dev
E: Unable to locate package libffi-dev
E: Unable to locate package liblzma-dev
E: Unable to locate package libgdbm-dev
E: Unable to locate package libnss3-dev
E: Unable to locate package libexpat1-dev
E: Unable to locate package uuid-dev^
sudo cat /var/lib/dpkg/statoverride | grep chrony
sudo dpkg-statoverride --remove /etc/chrony/chrony.keys
sudo dpkg-statoverride --remove /var/log/chrony
sudo apt-get install -f
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get install build-essential \
libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev libncurses-dev xz-utils \
tk-dev libffi-dev liblzma-dev libgdbm-dev \
libnss3-dev libexpat1-dev uuid-dev
pyenv install 3.11.9
pyenv global 3.11.9 # Set as default, or use pyenv local in a project directory
pyenv local 3.11.9
poetry env use $(pyenv which python)
poetry env info
poetry install --no-root
poetry add ipykernel --group dev
poetry run python -m ipykernel install --user --name=<KERNEL_NAME> --display-name="My Poetry Environment"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment