2

我正在使用 mod_wsgi + Python2.7。安装 mod_wsgi 后,我重新启动了 httpd。以下内容打印到我的 Apache 错误日志中。

"mod_wsgi pid=XXXX" Unable to import 'site' module.

点击IP地址会产生一个

" Import error No module named os "

在 Apache 错误日志中。

我已经使用yum install mod_wsgi 安装了 mod_wsgi。我知道安装它的更好方法是使用首选 Python 版本从源代码编译它。

(但是,这样做失败了。在./configure之后运行make会产生以下错误。

/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

)

使用Installation Issues中的线索,我检查了我的 mod_wsgi.so 安装是否正常。

运行一个

ldd /etc/httpd/modules/mod_wsgi.so

出品

[root@BLFLDT9454T mod_wsgi-3.4]# ldd /etc/httpd/modules/mod_wsgi.so
    libpython2.4.so.1.0 => /usr/lib64/libpython2.4.so.1.0 (0x00002b90b505d000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b90b5392000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002b90b55ae000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00002b90b57b3000)
    libm.so.6 => /lib64/libm.so.6 (0x00002b90b59b6000)
    libc.so.6 => /lib64/libc.so.6 (0x00002b90b5c39000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003530400000)

这表明共享库已经在使用中(如果我没记错的话)。

那么我哪里出错了?

谢谢, 舒比克

4

1 回答 1

0

In the document you reference, it says the following:

IOW. y Python installation has not been installed with --enable-shared when configure was run for Python.

Also, you do not seem to have removed the existing mod_wsgi properly either if what is installed is still referencing Python 2.4.

于 2013-08-28T09:11:29.913 回答