Installing Python 3.10.6 on CentOS 7 (7-2009) Prerequisites: yum -y groupinstall "Development Tools" yum -y install gcc openssl-devel bzip2-devel libffi-devel Add another repo for openssl11 yum install epel-release Install openssl11 yum install openssl11 yum install openssl11-devel Go to python source wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tar.xz tar -xvf Python-3.10.6.tar.xz cd Python-3.10.6 change python source to point to openssl11 sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure compile and build Python (enable-shared is important for pyinstaller) sudo ./configure --enable-optimizations --with-ensurepip=install --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" make -j8 make altinstall
Inspired by https://stackoverflow.com/questions/69539286/how-to-compile-python3-on-rhel-with-ssl-ssl-cannot-be-imported