

We can now proceed to install and use packages normally: pip install cowsay Select a different python version: pyenv global 3.8.0 We now have: * system (set by /home/cirsan01/.pyenv/version) List available Python versions: pyenv versions # Build and install a Python version from source. Xz-utils tk-dev libffi-dev liblzma-dev python-openssl git Libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ Sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ Install the python version you want: # Increase the chances that the build will have all dependencies. bashrc: export PATH="$/.pyenv/bin:$PATH"įind Python version to install: pyenv install -list Pyenv allows you to manage multiple Python versions without sudo for a single user, much like Node.js NVM and Ruby RVM. This method does not use apt-get, but it is, I believe, the best option available today, as it can easily compile any Python version from source for you, so you don't have to rely on any PPAs. Step 4 – Check the Python VersionĬheck the latest version installed of python using below command.

Make altinstall is used to prevent replacing the default python binary file /usr/bin/python. Use below set of commands to compile python source code on your system using altinstall. You can also download latest version in place of specified below. Sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-devĭownload Python using following command from python official site. sudo apt-get install build-essential checkinstall Use the following command to install prerequisites for Python before installing it. Just follow this steps (tested) : Step 1 – Install Required Packages
