Skip to content

Instantly share code, notes, and snippets.

@dukenmarga
Last active April 8, 2024 08:39
Show Gist options
  • Save dukenmarga/3b055616ecef3b38a52de0ad81b67c2a to your computer and use it in GitHub Desktop.
Save dukenmarga/3b055616ecef3b38a52de0ad81b67c2a to your computer and use it in GitHub Desktop.
Compile and Install Python 3.12 on openSuse 15.6

Notes to install Python 3.12

  • Download Python 3.12 source from the official website
  • Extract the files
  • Configure the files wih optimization enabled
./configure --enable-optimizations
  • Generate installation script
make
  • If it reported that it is missing some dependencies, it is recommended that you install what's suggested by the report. You can install the necessary packages that you are familiar with or maybe you can install as many packages as possible that are available in openSuse repository. Note that the packages required are development files. So for example the report stated it requires curses, then it means curses-dev or libcurses-dev (naming is for context example).

Special case for _ctypes, you need to install libffi-dev. This package is used for testing

  • Install to system as global
sudo make install
  • Don't forget to create symbolic link from lib64 to lib. Otherwise, we will get an error if we try to create a venv
sudo ln -s /usr/local/lib64/python3.12/lib-dynload /usr/local/lib/python3.12/lib-dynload

The error if we don't create the symlink:

python3.12 -m venv venv
Could not find platform dependent libraries <exec_prefix>
Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/usr/local/lib/python3.12/venv/__init__.py", line 10, in <module>
    import subprocess
  File "/usr/local/lib/python3.12/subprocess.py", line 104, in <module>
    from _posixsubprocess import fork_exec as _fork_exec
ModuleNotFoundError: No module named '_posixsubprocess'

See: here, here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment