問題描述
我有一個在 CentOS 上的 virtualenv 中運行的 python 應用程序.此應用程序需要一個以 rpm 形式分發和安裝的 python 庫.當應用程序運行時,我會得到 ??p>
沒有名為...的模塊
.
我已驗證 rpm 已正確安裝,并且我還在 virtualenv 的 site-packages 目錄中安裝了 rpm,但這并沒有幫助.安裝 rpm 以便在虛擬環境中運行的應用程序可以訪問它的正確方法是什么?
默認情況下,虛擬環境不訪問站點包中的模塊.您要么需要允許此類訪問(toggleglobalsitepackages
in virtualenvwrapper),要么使用選項 --system-site-packages
重新創建允許此類訪問的 virtualenv.
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?
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
.
這篇關于應用程序找不到安裝為 rpm 的 python 庫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!