I've been trying to install Python 3.12.2 with the SSL module in CentOS v7.9.2009 but I'm getting an error at the end. I have followed these steps but I always get the same error at the end:
[root@server Python-3.12.2]# make altinstall
./_bootstrap_python ./Programs/_freeze_module.py abc ./Lib/abc.py Python/frozen_modules/abc.h
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/usr/src/Python-3.12.2/Lib/site.py", line 73, in <module>
import os
File "/usr/src/Python-3.12.2/Lib/os.py", line 29, in <module>
from _collections_abc import _check_methods
SystemError: <built-in function compile> returned NULL without setting an exception
make: *** [Python/frozen_modules/abc.h] Error 1
I also get a failure in "test_embed" before that:
0:00:22 load avg: 0.95 [16/44] test_embed
test test_embed failed
0:00:30 load avg: 0.95 [17/44] test_float -- test_embed failed (2 errors)
Then, when I run Python I get the following output:
[root@server Python-3.12.2]# python3.12
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3.12'
isolated = 0
environment = 1
user site = 1
safe_path = 0
import site = 1
is in build tree = 0
stdlib dir = '/usr/local/lib/python3.12'
sys._base_executable = '/usr/local/bin/python3.12'
sys.base_prefix = '/usr/local'
sys.base_exec_prefix = '/usr/local'
sys.platlibdir = 'lib'
sys.executable = '/usr/local/bin/python3.12'
sys.prefix = '/usr/local'
sys.exec_prefix = '/usr/local'
sys.path = [
'/usr/local/lib/python312.zip',
'/usr/local/lib/python3.12',
'/usr/local/lib/python3.12/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fb3369f7740 (most recent call first):
<no Python frame>
When I don't use SSL Python is installed without any problem.
Following this other answer it installs just fine but I'd like to have the latest version as my project was made in the 3.12.2 version.
What should I do to fix this?