Hi, Is there a way to install python2 in Rocky Linux 9? Awaiting your response.
There is no official way to install python 2 on Rocky Linux 9. It is only available on Rocky Linux 8.
If you are really really desperate, then look at Spack https://spack.io/
I think it still has 2.7 in its repo (note: not a “yum repo”).
If you really need Python 2 and don’t mind building it from sources here’s the instructions:
dnf -y groupinstall "development tools"
# Latest Python 2.x version
curl -L -O https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
tar xf Python-2.7.18.tar.xz
cd Python-2.7.18
./configure --prefix=/usr/local --enable-shared --enable-unicode=ucs4
make && make altinstall
# Also add this line to .bash_profile or something
export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/bin/python2.7:$LD_LIBRARY_PATH
Also this https://rhel.pkgs.org/9/raven-x86_64/python2.7-2.7.18-30.el9.x86_64.rpm.html but that page mentions some third-party repo.
if you need work with many python versions , use pyenv :
1 Like