Application can't find python library installed as rpm

邮差的信 提交于 2019-12-31 05:10:19

问题


I have a python application that's run inside a virtualenv on CentOS. This application needs a python library that's distributed and installed as an rpm. When the application runs I just get

no module named ....

I've verified that the rpm is installed correctly, and I've also installed the rpm in the site-packages directory of the virtualenv but that didn't help. What is the correct way to install an rpm so that an application running in a virtual environment has access to it?


回答1:


By default virtual environments don't access modules in site-packages. You either need to allow such access (toggleglobalsitepackages in virtualenvwrapper) or recreate you virtualenv allowing such access with option --system-site-packages.




回答2:


It also might be a dependency problem. Try to reinstall the RPM using yum instead of rpm:

yum -y reinstall /path/to/your/file.rpm


来源:https://stackoverflow.com/questions/44513019/application-cant-find-python-library-installed-as-rpm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!