Problem
You want to manually install/compile Python 3.10 from source
Solution
This note applicable for Oracle Linux, Red Hat Linux and CentOS platforms
1) Install required system packages:
$ sudo yum install yum-utils
$ sudo yum-builddep python3
2) Ensure OpenSSL version is 1.1.1 at least:
$ openssl version
In case version is lower than 1.1.1, install the latest version:
CentOS 7 -- Custom Installation of OpenSSL 3 from Source Code
3) Create an installation directory. For the purposes of this note, Python 3.10 will be installed in /usr/local/python3.10
$ sudo mkdir -p /usr/local/python3.10
4) Download the source code of Python 3.10:
$ mkdir -p /tmp/python3.10
$ cd /tmp/python3.10
$ wget https://www.python.org/ftp/python/3.10.10/Python-3.10.10.tgz
5) Unpack the archive file:
$ tar xf Python-3.10.10.tgz
$ cd Python-3.10.10
6) Build Python 3.10 from the source code:
$ ./configure --enable-optimizations --prefix=/usr/local/python3.10 --with-openssl=/usr/local/openssl308 --with-openssl-rpath=auto
$ make -s
$ sudo make altinstall
Notes:
a) In case "Could not import runpy module" error received during the build process, try to build without --enable-optimizations
b) the above build assumes custom openssl was used. In case of using system openssl, remove -with-openssl and --with-openssl-rpath parameters
c) make altinstall is used not to overwrite system python installation
6) Verify custom python:
$ /usr/local/python3.10/bin/python3.10 --version
Python 3.10.10
Useful notes:
- https://number1.co.za/upgrading-sqlite-on-centos-to-3-8-3-or-later/
No comments:
Post a Comment