openeuler:20.09 编译安装 python3.9 ModuleNotFoundError: No module named ‘dnf‘ 问题修复

目录

问题描述:

修复步骤:

1、编译参数设置

2、复制python3.8配置

3、修改_gpgme.cpython-38-x86_64-linux-gnu.so文件名


问题描述:

编译安装完成后,yum、dnf命令无法使用提示 ModuleNotFoundError: No module named 'dnf' 

修复步骤:

1、编译参数设置

./configure -prefix=/usr --enable-optimizations --with-platlibdir=lib64
make -j8 && make install 

2、复制python3.8配置

cp -rf /usr/lib/python3.8/site-packages/dnf-plugins /usr/lib/python3.9/site-packages/dnf-plugins && \
cp -rf /usr/lib/python3.8/site-packages/dnf /usr/lib/python3.9/site-packages/dnf && \    
cp -rf /usr/lib64/python3.8/site-packages/libdnf /usr/lib64/python3.9/site-packages/libdnf && \
cp -rf /usr/lib64/python3.8/site-packages/rpm /usr/lib64/python3.9/site-packages/rpm && \
cp -rf /usr/lib64/python3.8/site-packages/libcomps /usr/lib64/python3.9/site-packages/libcomps && \
cp -rf /usr/lib64/python3.8/site-packages/gpg /usr/lib64/python3.9/site-packages/gpg && \
cp -rf /usr/lib64/python3.8/site-packages/hawkey /usr/lib64/python3.9/site-packages/hawkey

3、修改_gpgme.cpython-38-x86_64-linux-gnu.so文件名

mv /usr/lib64/python3.9/site-packages/gpg/_gpgme.cpython-38-x86_64-linux-gnu.so /usr/lib64/python3.9/site-packages/gpg/_gpgme.cpython-39-x86_64-linux-gnu.so

你可能感兴趣的:(openeuler,linux,gnu,centos)