我正在尝试在我的 Web 服务器上安装 Python 3.2 和 mod_wsgi,但运气不佳。
我下载了 Python 源文件并使用以下命令进行编译:
./configure --enable-shared --prefix=/opt/python-3-2 LDFLAGS="-Wl,-rpath /opt/python-3-2/lib"
我还修改了路径变量以包含并从中/opt/python-3-2/bin
创建了指向二进制文件的符号链接。现在,如果我从命令行运行,我会得到正确的提示。python3
/opt/python-3-2/bin/python
python
> python
Python 3.2.2 (default, Jan 20 2012, 18:14:20)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
我使用以下设置来编译最新版本的 mod_wsgi
./configure --with-apxs=/usr/sbin/apxs --with-python=/opt/python-3-2/bin/python3
这会产生以下错误
mod_wsgi.c:8937: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8939: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8941: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8945: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8965: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8967: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8970: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c: In function 'wsgi_daemon_worker':
mod_wsgi.c:10279: warning: unused variable 'duration'
mod_wsgi.c:10278: warning: unused variable 'start'
mod_wsgi.c: In function 'wsgi_hook_daemon_handler':
mod_wsgi.c:12499: warning: unused variable 'i'
mod_wsgi.c:12497: warning: unused variable 'elts'
mod_wsgi.c:12496: warning: unused variable 'head'
mod_wsgi.c: In function 'Auth_environ':
mod_wsgi.c:13375: warning: assignment makes pointer from integer without a cast
mod_wsgi.c: At top level:
mod_wsgi.c:7154: warning: 'wsgi_set_py3k_warning_flag' defined but not used
mod_wsgi.c:7856: warning: 'wsgi_set_user_authoritative' defined but not used
mod_wsgi.c:14414: warning: 'wsgi_hook_check_user_id' defined but not used
/usr/lib/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la -rpath /usr/lib/httpd/modules -module -avoid-version mod_wsgi.lo -L/opt/python-3-2/lib -L/opt/python-3-2/lib/python3.2/config -lpython3.2 -lpthread -ldl -lutil -lm
/usr/bin/ld: cannot find -lpython3.2
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
我曾尝试创建符号链接,/opt/python-3-2/lib/python3.2/config -> /opt/python-3-2/lib/libpython3.so
但没有帮助。
答案1
您当前必须使用来自 Python 3.2 源代码库的 mod_wsgi 源代码,不能使用 mod_wsgi 3.3 源代码。