# 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](https://github.com/pyenv/pyenv). ## Pyenv and Python3 Installation Script * Connect to your Ultra.cc service via SSH, see guide [here](https://docs.ultra.cc/books/secure-shell-%28ssh%29/page/how-to-connect-to-your-ultracc-slot-via-ssh). * Once connected, execute the following command: ```sh bash <(wget -qO- https://scripts.ultra.cc/util-v2/LanguageInstaller/Python-Installer/main.sh) ``` * Select the Python version to install by typing `1`, `2`, `3`, `4` or `5` and then press `ENTER` * Wait while the script download and install the necessary files * To load Python with pyenv in your shell, execute the following command: ```sh source ~/.profile ``` * Check which Python binary you are currently using by executing `which python`. * The below output is what you should see. ``` 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](https://docs.ultra.cc/link/376#bkmrk-pip) usage instructions, see [this guide](https://docs.ultra.cc/link/393#bkmrk-install-python-packa). #### List Installed Python Versions * Execute the following SSH command: ```sh pyenv versions ``` * Assuming that you used the script to install python 3.9, the output will look like this: ``` ultradocs@pollux:~$ pyenv versions system * 3.9.13 (set by /home/ultradocs/.pyenv/version) ultradocs@pollux:~$ ``` * The `*` beside `3.9.13` means that pyenv has set it as the global python version. #### Install other Python versions using Pyenv * Execute the following SSH command: ```sh pyenv install --list | grep -E " 3.[8-9].*| 3.10.*" ``` * It will list all versions of python from version 3.8 to version 3.10 available for install via pyenv. * Example output: ``` 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:~$ ``` * You can install any one of them easily with the following SSH command: ```sh pyenv install -v