Install Python Using Pyenv

This is an unofficial script that is provided for your convenience. The script is provided as-is and may not be updated or maintained by Ultra.cc. Customers are welcome to use and customize unofficial scripts for their unique needs and requirements. Unofficial support may be offered via Discord only and at the sole discretion of Ultra.cc staff. Use at your own risk.

pyenv lets you easily switch between multiple versions of Python. It is simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

At a high level, pyenv intercepts Python commands using shim executables injected into your PATH, determines which Python version has been specified by your application, and passes your commands along to the correct Python installation.

For more information, visit the pyenv GitHub repository.

Pyenv and Python3 Installation Script

bash <(wget -qO- https://scripts.ultra.cc/util-v2/LanguageInstaller/Python-Installer/main.sh)
source ~/.profile
ultradocs@pollux:~$ which python
/home/ultradocs/.pyenv/shims/python

Pyenv Usage Guide

In this section, you will learn some basic usage of pyenv. If you are looking for pip usage instructions, see this guide.

List Installed Python Versions

pyenv versions
ultradocs@pollux:~$ pyenv versions
  system
* 3.9.13 (set by /home/ultradocs/.pyenv/version)
ultradocs@pollux:~$ 

Install other Python versions using Pyenv

pyenv install --list | grep -E " 3.[8-9].*| 3.10.*"
ultradocs@pollux:~$ pyenv install --list | grep -E " 3.[8-9].*| 3.10.*"
  3.8.0
  3.8-dev
  3.8.1
  3.8.2
  3.8.3
  3.8.4
  3.8.5
  3.8.6
  3.8.7
  3.8.8
  3.8.9
  3.8.10
  3.8.11
  3.8.12
  3.8.13
  3.9.0
  3.9-dev
  3.9.1
  3.9.2
  3.9.4
  3.9.5
  3.9.6
  3.9.7
  3.9.8
  3.9.9
  3.9.10
  3.9.11
  3.9.12
  3.9.13
  3.10.0
  3.10-dev
  3.10.1
  3.10.2
  3.10.3
  3.10.4
ultradocs@pollux:~$ 
pyenv install -v <version number>

For example: 
pyenv install -v 3.10.4
ultradocs@pollux:~$ pyenv install -v 3.10.4
ultradocs@pollux:~$ pyenv versions
  system
  3.10.4
* 3.9.13 (set by /home/ultradocs/.pyenv/version)
ultradocs@pollux:~$
pyenv global <version>

For example:
pyenv global 3.10.4
ultradocs@pollux:~$ pyenv global 3.10.4
ultradocs@pollux:~$ pyenv versions
  system
* 3.10.4 (set by /home/ultradocs/.pyenv/version)
  3.9.13
ultradocs@pollux:~$ python -V
Python 3.10.4
ultradocs@pollux:~$ 

Uninstall a Python version using Pyenv

pyenv uninstall <version>

Example:
pyenv uninstall 3.9.13
ultradocs@pollux:~$ pyenv versions
  system
* 3.10.4 (set by /home/ultradocs/.pyenv/version)
  3.9.13
ultradocs@pollux:~$ pyenv uninstall 3.9.13
pyenv: remove /home/ultradocs/.pyenv/versions/3.9.13? [y|N] y
pyenv: 3.9.13 uninstalled
ultradocs@pollux:~$ 

Uninstall Pyenv and the Python version(s) installed by it

bash <(wget -qO- https://scripts.ultra.cc/util-v2/LanguageInstaller/Python-Installer/main.sh)

Manual Uninstallation

rm -rf ~/.pyenv
nano ~/.profile
source ~/.profile 

Revision #16
Created 23 May 2022 14:03:56 by Raikiri
Updated 7 August 2024 07:48:01 by varg