wget https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tgz
Extract downloaded archive
tar xvf Python-3.11.2.tgz
Navigate into created directory.
cd Python-3.11*/
Configure the build
LDFLAGS=”${LDFLAGS} -Wl,-rpath=/usr/local/openssl/lib” ./configure –with-openssl=/usr/local/openssl
make
Install Python 3.11 on CentOS 7 / RHEL 7
sudo make altinstall
After installation, you can check the installed version of Python 3.11 with the command:
$ python3.11 –version
Python 3.11.2
Verify OpenSSL libs work
$ python3.11
Python 3.11.2 (main, Feb 24 2023, 12:20:28) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import ssl
>>> ssl.OPENSSL_VERSION
‘OpenSSL 1.1.1t 7 Feb 2023’
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> Ctrl-D
Step 5: Install Python modules using Pip3.11
Pip is installed during Python installation. Check the pip version installed by running this command.
$ pip3.11 –version
pip 22.3.1 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
You can upgrade your Pip package to latest release:
pip3.11 install –upgrade pip
Now use PIP to install any module. The command to use has the syntax:
sudo pip3.11 install
For example:
sudo pip3.11 install awscli
Conclusion
In conclusion, Python’s versatility, simplicity, and its capabilities make it an excellent choice for anyone looking to learn or adopt a programming language for various applications and projects. There are numerous libraries, frameworks, and tools that enables you to build innovative applications efficiently.