我正在尝试让 mod_wsgi 在我的 CentOs 服务器上工作,这样我就可以在 apache 上运行 Django 站点。我已经安装了与 2.4 并行的 python2.7(因为您必须保留 2.4 才能让 yum 满意),root 用户正在使用 2.7。我想做:
# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
# tar -zxvf mod_wsgi-3.3.tar.gz
# cd mod_wsgi-3.3
# ./configure --help
# ./configure --with-python=/usr/local/python27/bin/python
# make
# make_install
但是 make 失败了;它给了我一个巨大的错误,我将在下面发布。我在谷歌上搜索了一下,发现我可能缺少 python2.7-dev 或 python2.7-devel 包,类似的东西,也是因为错误的第一行报告缺少 .h 文件。
但我在 centos 上找不到 2.7 的开发包。所以我希望有人能给我一点提示,谢谢。
这是错误,我中间去掉了好多!提前致谢!
[root@ve mod_wsgi-3.3]# make
/usr/sbin/apxs -c mod_wsgi.c -Wl,-F -framework
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c:135:20: error: Python.h: No such file or directory
mod_wsgi.c:138:2: error: #error Sorry, Python developer package does not appear to be installed.
mod_wsgi.c:142:2: error: #error Sorry, mod_wsgi requires at least Python 2.3.0 for Python 2.X.
mod_wsgi.c:150:2: error: #error Sorry, mod_wsgi requires that Python supporting thread.
mod_wsgi.c:153:21: error: compile.h: No such file or directory
mod_wsgi.c:154:18: error: node.h: No such file or directory
mod_wsgi.c:155:20: error: osdefs.h: No such file or directory
mod_wsgi.c:188: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Auth_Type'
mod_wsgi.c: In function 'wsgi_server_group':
mod_wsgi.c:949: warning: unused variable 'value'
mod_wsgi.c: At top level:
mod_wsgi.c:1348: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Dispatch_Type'
mod_wsgi.c:1351: error: expected specifier-qualifier-list before 'PyObject_HEAD'
mod_wsgi.c:1363: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Log_Type'
mod_wsgi.c:1365: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
### Endless jaberish about missing files, members, misinterpreted characters, unused vars and whatnot. Not going to post it all, unless someone needs it.
mod_wsgi.c:14469: error: expected ';' before 'apr_thread_mutex_lock'
mod_wsgi.c:14470: error: 'Py_END_ALLOW_THREADS' undeclared (first use in this function)
mod_wsgi.c:14473: error: expected ';' before 'modules'
mod_wsgi.c:14474: error: expected identifier or '(' before '=' token
mod_wsgi.c:14476: error: expected expression before 'module'
mod_wsgi.c:14478: error: expected expression before 'module'
mod_wsgi.c:14487: error: expected expression before 'module'
mod_wsgi.c:14488: error: expected expression before 'module'
mod_wsgi.c:14499: error: expected expression before 'module'
mod_wsgi.c:14500: error: expected identifier or '(' before '=' token
mod_wsgi.c:14506: error: expected expression before 'module'
mod_wsgi.c:14507: error: expected identifier or '(' before '=' token
mod_wsgi.c:14522: error: expected expression before 'module'
mod_wsgi.c:14523: error: 'module_dict' undeclared (first use in this function)
mod_wsgi.c:14524: error: 'object' undeclared (first use in this function)
mod_wsgi.c:14526: error: expected expression before 'module'
mod_wsgi.c:14530: error: 'vars' undeclared (first use in this function)
mod_wsgi.c:14531: error: 'args' undeclared (first use in this function)
mod_wsgi.c:14532: error: 'result' undeclared (first use in this function)
mod_wsgi.c:14533: error: 'method' undeclared (first use in this function)
mod_wsgi.c:14550: error: 'Py_None' undeclared (first use in this function)
mod_wsgi.c:14564: error: 'Py_True' undeclared (first use in this function)
mod_wsgi.c:14567: error: 'Py_False' undeclared (first use in this function)
mod_wsgi.c:14579: error: 'PyExc_TypeError' undeclared (first use in this function)
mod_wsgi.c:14595: error: 'AuthObject' has no member named 'r'
mod_wsgi.c:14599: error: 'AuthObject' has no member named 'log'
mod_wsgi.c:14602: error: 'PyExc_AttributeError' undeclared (first use in this function)
mod_wsgi.c:14604: error: 'AuthObject' has no member named 'log'
mod_wsgi.c:14617: error: expected expression before ')' token
mod_wsgi.c:14624: error: expected ';' before 'ap_log_rerror'
mod_wsgi.c:14629: error: expected ';' before '}' token
mod_wsgi.c:14634: error: too many arguments to function 'wsgi_log_python_error'
mod_wsgi.c:14639: error: expected expression before 'module'
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
答案1
我将彻底删除它并安装 2.7 rpms。
rm -rf /usr/local/python27/
然后是 64 位
http://star4u.org/files/rhel5/x86_64/RPMS/
32位