Pyenv builds Python versions from source and therefore requires all the necessary build dependencies.
sudo yum install gcc zlib-devel bzip2 bzip2-devel patch readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel
You'll need git
installed to be able to clone the repositories
sudo yum install git
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo ' ' >> ~/.bash_profile
echo '# Pyenv Configuration' >> ~/.bash_profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
pyenv
To prevent any existing system dependencies from breaking, it's a good idea to setup pyenv with versions of the current existing python installations.
Make a note of the version numbers currently installed for python2
and python3
.
$ python -V
Python 2.7.5
$ python3 -V
Python 3.6.8
pyenv install 2.7.5
pyenv install 3.6.8
pyenv global 3.6.8 2.7.5
Check that the versions are associated correctly
$ pyenv versions
system
* 2.7.5 (set by /home/norsey/.pyenv/version)
* 3.6.8 (set by /home/norsey/.pyenv/version)
pip install --upgrade pip
pip install --user pipenv
Here are the packages that I installed in order to install python 3.10.10 via pyenv