即使在.conf文件中指定了.so的目录路径,{ld44}也找不到.so

时间:2019-02-06 21:01:41

标签: linux apache flask anaconda mod-wsgi

我需要诊断为什么ldconfig似乎找不到我为其提供路径的.so文件的帮助。

我正在设置将以mod_wsgi / httpd开头的Python flask应用程序。我正在将Anaconda用于我的Python环境控制,并已通过mod_wsgipip安装到Anaconda环境中。我通过httpd.confmod_wsgi-express module-config文件生成了配置行,如以下问题Anaconda + Apache + mod_wsgi + Ubuntu所述。尝试启动httpd时,出现此错误

httpd: 
Syntax error on line 353 of /etc/httpd/conf/httpd.conf: 
Syntax error on line 4 of /etc/httpd/conf.d/myserver.httpd.conf: 
Cannot load /conda/envs/my_env/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so into server: 
/conda/envs/my_env/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so: 
cannot open shared object file: 
Permission denied

看着这个错误,我发现了这个问题:Can't load mod_wsgi compiled for Python 3,并尝试了其中所述的选项:Or add the directory /opt/anaconda/anaconda3/lib to the library search path using a conf file in /etc/ld.so.conf.d/, that would be a global setting tough.

我用以下行创建了mod_wsgi.conf

/conda/envs/my_env/lib

在目录/etc/ld.so.conf.d内并运行ldconfig以刷新ld.so.cache。使用-v运行时,我可以看到/lib内部的.so已成功链接。重新启动httpd会产生相同的结果,并且我注意到mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so未包含在详细列表中。然后,我将以下行添加到mod_wsgi.conf

/conda/envs/my_env/lib/python3.5/site-packages/mod_wsgi/server

并重新运行ldconfig,但是mod_wsi*.so并未出现在详细列表中。

包括以下文件:

myserver.httpd.conf

ServerName myserver.example.com

LoadModule wsgi_module "/conda/envs/my_env/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so
WSGIPythonHome "/conda/envs/myenv"

Listen 8008

<VirtualHost *:8008>
    ServerName myserver.example.com
    ServerAlias myserver.example.com
    ServerAdmin webmaster@example.com

    WSGIDaemonProcess myapp
    WSGIScriptAlias /myapp /usr/local/src/myapp.wsgi

    <Directory /usr/local/src>
        WSGIProcessGroup myapp
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
    </Directory>
</VirtualHost>

mod_wsgi.conf

/conda/envs/my_env/lib
/conda/envs/my_env/lib/python3.5/site-packages/mod_wsgi/server

这就是我从ldconfig -v得到的:

...
/conda/envs/my_env/lib:
        libpython3.5m.so.1.0 -> libpython3.5m.so.1.0
        libsqlite3.so.0 -> libsqlite3.so.0.8.6
        libtk8.6.so -> libtk8.6.so
        libtcl8.6.so -> libtcl8.6.so
        libreadline.so.7 -> libreadline.so.7.0
        libhistory.so.7 -> libhistory.so.7.0
        libedit.so.0 -> libedit.so.0.0.56
        libz.so.1 -> libz.so.1.2.11
        liblzma.so.5 -> liblzma.so.5.2.4
        libssl.so.1.0.0 -> libssl.so.1.0.0
        libcrypto.so.1.0.0 -> libcrypto.so.1.0.0
        libtinfow.so.6 -> libtinfow.so.6.1
        libpanelw.so.6 -> libpanelw.so.6.1
        libncursesw.so.6 -> libncursesw.so.6.1
        libmenuw.so.6 -> libmenuw.so.6.1
        libformw.so.6 -> libformw.so.6.1
        libffi.so.6 -> libffi.so.6.0.4
        libstdc++.so.6 -> libstdc++.so.6.0.25
        libubsan.so.1 -> libubsan.so.1.0.0
        libtsan.so.0 -> libtsan.so.0.0.0
        libquadmath.so.0 -> libquadmath.so.0.0.0
        liblsan.so.0 -> liblsan.so.0.0.0
        libitm.so.1 -> libitm.so.1.0.0
        libgomp.so.1 -> libgomp.so.1.0.0
        libgcc_s.so.1 -> libgcc_s.so.1
        libatomic.so.1 -> libatomic.so.1.2.0
        libasan.so.5 -> libasan.so.5.0.0
/conda/envs/my_env/lib/python3.5/site-packages/mod_wsgi/server:
/usr/lib64:
...

在此先感谢您的帮助!

0 个答案:

没有答案