简体   繁体   English

无法从源代码安装mod_wsgi

[英]Unable to install mod_wsgi from source

While trying to install modwisgi-3.4 I was getting the following error during make : mod_wsgi.c:142:20: error: Python.h: No such file or directory The official troubleshoot page http://code.google.com/p/modwsgi/wiki/InstallationIssues suggests to "install the developer package for Python corresponding to the Python runtime package you have installed". 尝试安装modwisgi-3.4时,在make过程中出现以下错误: mod_wsgi.c:142:20: error: Python.h: No such file or directory官方疑难解答页面http://code.google.com/p / modwsgi / wiki / InstallationIssues建议“安装与您已安装的Python运行时软件包相对应的Python开发人员软件包”。

Now how to install the mentioned development package from source? 现在如何从源代码安装提到的开发包? I am running python2.7.4 on linux with httpd-2.2.24 and modwisgi 3.4. 我正在使用httpd-2.2.24和modwisgi 3.4在linux上运行python2.7.4。

Run the following: 运行以下命令:

$ python-config --cflags

This will give you a list of flags to pass to the compiler to find Python.h: 这将为您提供标志列表,以传递给编译器以查找Python.h:

$ python-config --cflags
-I/usr/include/python3.3m -I/usr/include/python3.3m -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=
1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-pr
otector --param=ssp-buffer-size=4 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ss
p-buffer-size=4

You'll probably also want to run python-config --ldflags for the necessary linker flags. 您可能还需要为必要的链接器标志运行python-config --ldflags

If you have multiple versions of Python installed, you can specify, ie, python2.7-config 如果安装了多个版本的Python,则可以指定python2.7-config

Then, I would manually edit the file posix-ap2X.mk.in so that it contains the following: 然后,我将手动编辑文件posix-ap2X.mk.in ,使其包含以下内容:

CFLAGS = @CFLAGS@ $(shell python-config --cflags)
LDFLAGS = @LDFLAGS@ $(shell python-config --ldflags)

The configure.ac Autoconf file tries to figure this stuff out but it seems to do it in a clunky way that is apparently not working for you, so this manual way will hopefully sort things out. configure.ac Autoconf文件试图找出这些东西,但是似乎以一种笨拙的方式来完成它,显然对您不起作用,因此希望这种手动方式可以解决这些问题。

Edit: oh, also, be sure that you use the correct python-config and that you specify which Python interpreter to use as necessary. 编辑:哦,也请确保使用正确的python-config并根据需要指定要使用的Python解释器。 For example, if you have installed Python from source to some non-standard location while there is another version installed in the usual place, be sure to specify this (ie use /path/to/my/python-config in the above edits and pass the argument PYTHON=/path/to/my/python to the configure script). 例如,如果您已将Python从源代码安装到某个非标准位置,而通常又安装了另一个版本,请确保指定此名称(即,在上面的编辑中使用/path/to/my/python-config和将参数PYTHON=/path/to/my/python传递给configure脚本)。 In fact, simply specifying the correct Python interpreter might cause the included configure script to do its job correctly. 实际上,仅指定正确的Python解释器可能会导致所包含的configure脚本正确执行其工作。

You must use the --with-python option to mod_wsgi configure to tell it the path to the 'python' binary you installed from source code. 您必须使用--with-python选项将mod_wsgi配置为告诉它从源代码安装的“ python”二进制文件的路径。 It looks like you haven't done that and it is still using the system Python which doesn't have the corresponding dev package installed. 看来您尚未执行此操作,并且仍在使用系统Python,该系统未安装相应的dev软件包。 Provide the details of the actual 'configure' script command line when you ran it and tell us where your self installed Python actually lives. 在运行时提供实际“配置”脚本命令行的详细信息,并告诉我们您自己安装的Python实际位于何处。 Also make sure you run 'make distclean' to clear out the results of any old build in case that is confusing things. 另外,请确保运行“ make distclean”以清除所有旧版本的结果,以防万一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM