Skip to content
Shamik edited this page Jan 12, 2024 · 9 revisions

Install any python version without a package manager

Install dependencies

Official Instructions

sudo apt update; sudo apt install 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

Installation of Pyenv

Automatic Installation

Installation for Ubuntu

curl https://pyenv.run | bash

Restart bash

exec "$SHELL"

Pyenv Update

pyenv update

Install any version of python

# pyenv install <python version>
pyenv install miniconda3-3.7-4.12.0

Check what pyenv resolves a specific python version to

pyenv latest -k <python version>
pyenv latest -k 3.8

Install a latest python specific version

pyenv latest <python version>
pyenv latest 3.8

List all available python versions

pyenv install -l

Select a particular python version

To select a Pyenv-installed Python as the version to use, run one of the following commands:

pyenv shell <version> -- select specific python version just for current shell session

pyenv shell --unset -- unsets the current python version for current shell session

pyenv shell -- displays the current python version for current shell session

pyenv local <version> -- automatically select whenever you are in the current directory (or its subdirectories)

pyenv local --unset -- unsets the current python version for the current directory (or its subdirectories)

pyenv local -- displays the current python version whenever you are in the current directory (or its subdirectories)

pyenv global <version> -- select globally for your user account

pyenv global -- displays the current python version globally for your user account

pyenv global system -- select globally the system python for your user account

Clone this wiki locally