Requires a [PyEnv setup](PyEnv%20setup.md).
# Adding #Python versions
```shell
pyenv install --list | rg ' +[1-9].' | tail
```
```shell
pyenv install $VERSION # get a better Python version than your system's
```
```shell
pyenv global $VERSION # set up your default python
```
Setting `global` helps avoid messing up your system python (alternatively: pip install --user), e.g. by choosing a special venv to use.
Alternatively, to use a specific Python env in the current directory tree, use:
```shell
pyenv local $NAME
```
# Using Virtual Environments
This is optional; It probably is wiser to use a [[Poetry setup]] to manage virtual environments for development.
## venv setup
The first useful case for a pyenv venv is to set a global pyenv.
```bash
pyenv virtualenv 3.x.x name-of-venv
```
## listing and activating venvs
Better: see [[Poetry usage]] to manage dev environments
```bash
pyenv virtualenvs
pyenv activate name-of-venv-3.x.x
```
## Adding Python packages
see [[Python packages]]