In the previous post, I documented my attempt to install Python 3.12 on my CentOS 7, which ended in failure due to compilation errors. After an extensive search, I identified the issue as an outdated version of gcc, with CentOS 7 using gcc 4.8.5 while the latest version is gcc 13. Upgrading gcc to the latest version in CentOS proved challenging, but Software Collections (SCL) offered a potential solution. Given the considerable time investment required, I didn’t proceed with the SCL installation and experimentation. This post is motivated by that decision. I will explore SCL in this post, aiming to successfully run Python 3.12 with the assistance of SCL.
SCL in CentOS 7
To maintain the core stability and security of CentOS, not all software is kept constantly updated. This is why essential tools like gcc or Python may only come with older versions and are challenging to update. However, to enable users to access new features from updates while ensuring core stability, Software Collections (SCL) allows users to install multiple versions concurrently. For instance, by installing and enabling SCL, I can have both gcc 11 for compiling Python 3.12 and gcc 4 along with Python 2.7 simultaneously.
Install SCL
Installing SCL is a straightforward process. Simply execute the following command:
yum install centos-release-scl
Install Develop Toolkit
Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform. It provides current versions of the GNU Compiler Collection, GNU Debugger, and other development, debugging, and performance monitoring tools. Here is the homepage of Develop Toolkit 8. When I am running this post, it’s surprised to find there is develop tool kit 11. So I just install the latest version.
yum install devtoolset-11
Using GCC 11 in CentOS 7
After successfully installing all the necessary software, I can harness the power of the latest GCC by enabling SCL and developing toolkits with the following command.
scl enable devtoolset-11 bash
To ensure that I am working in Bash with SCL enabled, I can verify by checking the gcc version.
Compile Python 3.12 with GCC 11
Now, it’s time for me to attempt Python 3.12. The installation instructions are nearly identical to what I did for Python 3.10. I won’t repeat the steps here; please refer to this post for guidance.