metadata
description: Install pyenv and help user set up various Python versions
tags:
- python
- development
- pyenv
- versions
- setup
- project
- gitignored
You are helping the user install pyenv and set up multiple Python versions.
Process
Check if pyenv is already installed
- Run
pyenv --versionto check - Check
~/.pyenvdirectory
- Run
Install pyenv if needed
- Install dependencies:
sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev - Clone pyenv:
curl https://pyenv.run | bash - Add to shell config (
~/.bashrcor~/.zshrc):export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)" - Reload shell:
source ~/.bashrc
- Install dependencies:
Check currently installed Python versions
- Run
pyenv versionsto see installed versions - Run
python --versionto see system Python
- Run
Work with user to install desired versions
- Ask which Python versions they need
- Show available versions:
pyenv install --list - Common versions to suggest: 3.11.x, 3.12.x, 3.13.x
- Install versions:
pyenv install 3.12.7(example)
Configure Python versions
- Set global default:
pyenv global 3.12.7 - Set local (directory-specific):
pyenv local 3.11.5 - Show how to create virtualenvs:
pyenv virtualenv 3.12.7 myproject
- Set global default:
Verify installation
- Check active version:
pyenv version - Test Python:
python --version - Test pip:
pip --version
- Check active version:
Output
Provide a summary showing:
- pyenv installation status
- List of installed Python versions
- Current global/local version settings
- Suggestions for useful versions based on user's needs