File size: 1,886 Bytes
279efce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
---
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
1. **Check if pyenv is already installed**
- Run `pyenv --version` to check
- Check `~/.pyenv` directory
2. **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 (`~/.bashrc` or `~/.zshrc`):
```bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
```
- Reload shell: `source ~/.bashrc`
3. **Check currently installed Python versions**
- Run `pyenv versions` to see installed versions
- Run `python --version` to see system Python
4. **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)
5. **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`
6. **Verify installation**
- Check active version: `pyenv version`
- Test Python: `python --version`
- Test pip: `pip --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
|