Pyenv Install Centos 8
Published: 2020-11-24
Intro
Pyenv is a similar tool to rbenv, where you can easily install and use mulitple versions of python. This allows you to test across multiple versions of python as well as pin an app to a specific release.
Software Versions Used
- Centos - 8.2.2004
- Pyenv - 1.2.21
Pre-requisites
Install the dependencies required to use pyenv.
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y zlib zlib-devel bzip2-devel openssl-devel sqlite-devel readline-develInstallation
Use the installed script to install pyenv.
curl https://pyenv.run | bashUpdate your shell environment, I am using zsh.
# ~/.zshrc
# PYENV
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# PYENV Auto-completions. This should be towards the end of the file.
eval "$(pyenv init -)"Restart your shell environment.
exec "$SHELL"Verify the version of pyenv installed.
pyenv --version
# output
pyenv 1.2.21Usage
Install a version of python.
# Python 3
pyenv install 3.8.6
# Python 2
pyenv install 2.7.16Install a version of python.
# Python 3
pyenv install 3.8.6
# Python 2
pyenv install 2.7.16Use a version of python.
# Application specific python version(s).
pyenv local 3.8.6 2.7.16
# Systemwide python version(s)
pyenv global 3.8.1 2.7.18Outro
Welcome to the end. If you followed along you will have pyenv installed and configured for use on Centos 8.
Links
https://github.com/pyenv/pyenv
https://github.com/pyenv/pyenv-installer
https://medium.com/@aokany/pyenv-installation-and-python-venv-usage-on-centos-8-68a144b88203