'Error while trying to install python 3.8.12 32bit version in 64bit machine in REDHAT7

I need Libpython.so for one of my application which was a 32bit one compiled in 64bit RHEL7 machine. So, below steps I followed to install 32bit Python.

  1. sudo wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
  2. sudo tar xzf Python-3.8.12.tgz
  3. cd Python-3.8.12
  4. sudo ./configure --enable-shared --enable-optimizations --with-universal-archs=3-way --prefix=/usr/local
  5. Modified the Makefile such that in compiles for 32bit. Added -m32 flag in all the required places.
  6. sudo make install

At the end of last step, I got the below error.

Fatal Python error: _PySys_InitCore: can't initialize sys module
Python runtime state: preinitialized

Any help in resolving this issue is greatly appreciated. Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source