How to install Python 10 on CentOS 7
First, install the dependency
1 2 |
yum install -y wget zlib-devel yum groupinstall -y "Development tools" |
Install OpenSSL as the openssl-devel package provided by CentOS is old version. Install OpenSSL from source with
1 2 3 4 5 6 7 |
cd /usr/local/src wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz tar xvf openssl-1.1.1g.tar.gz cd openssl-1.1.1g ./config --prefix=/usr/serverok/openssl --openssldir=/usr/serverok/openssl no-ssl2 make make install |
Run following commands
1 2 3 4 |
export PATH=/usr/serverok/openssl/bin:$PATH export LD_LIBRARY_PATH=/usr/serverok/openssl/lib export LC_ALL="en_US.UTF-8" export LDFLAGS="-L/usr/serverok/openssl/lib -Wl,-rpath,/usr/serverok/openssl/lib" |
Download the latest version of Python from
https://www.python.org/downloads/
To install, run
1 2 3 4 5 6 7 |
cd /usr/local/src 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 /usr/local/src/Python-3.10.6 make clean && make distclean ./configure --enable-optimizations --with-openssl=/usr/serverok/openssl/ make altinstall |
Python 10 will be installed in folder
1 |
/usr/local/bin/python3.10 |
To install pip modules, you can use
1 |
python3.10 -m pip install -r requirements.txt |
Back to Python