Managing programming environments#
Installing pyenv#
$ git clone https://github.com/pyenv/pyenv.git ./.pyenv
$ echo -e "export PATH=\"\$HOME/.pyenv/bin:\$PATH\"\neval \"\$(pyenv init --path)\"\n" > start-pyenv
$ chmod +x start-pyenv
Starting pyenv#
$ cd ~
$ source ./start-pyenv
Listing available python systems#
$ pyenv install --list
Installing a python system#
The following example installs CPython version 3.9.16
$ pyenv install 3.9.16
Listing installed python systems#
$ pyenv versions
Changing the selected python system#
In the following example, the working python system is set to CPython version 3.9.16
$ pyenv global 3.9.1
Using the currently selected python system#
$ python
Virtual python environments#
The following assumes you have installed and started pyenv
Creating a new environment#
$ mkdir project-1
$ cd project-1
$ python -m venv env
Starting an existing environment#
$ cd project-1
$ source ./env/bin/activate
Stop a running environment#
$ deactivate
Removing an environment#
$ rm -rf project-1