'How to install rpm-python binding to python3 site-packages
I have python2.7 and python3.8 installed on Centos 6.10.
Current Rpm version is 4.8.0. Python2.7 is managed to import the rpm module but not Python3.8.
These are the files in python2.7/site-packages/rpm directory
__init__.py
__init__.pyo
__init__.pyc
_rpmmodule.so
_rpmbmodule.so
transaction.py
transaction.pyc
transaction.pyo
How to add the rpm-python to Python3/site-packages so that it can be imported.
Solution 1:[1]
This is completely wrong. Even if you copy it to python3.8 directory, it will not work. Because of missing .so libraries or in incorrect version. Or because of incompatibilities between python2 and python3.
If you need python3 then use CentOS 8. CentOS 6 is EOLed anyway.
Solution 2:[2]
The Python source code for RPM is inside the RPM package. You can download it from http://rpm.org/download.html
And when running the configure script, make sure to specify the --enable-python
option.
Python 3 should be detected, and the bindings + the libraries created and then installed.
I just tested this with Python 3.9.6 and RPM 4.7.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | msuchy |
Solution 2 | Olivier M. |