简体   繁体   中英

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".

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.

Run the following:

$ python-config --cflags

This will give you a list of flags to pass to the compiler to find 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.

If you have multiple versions of Python installed, you can specify, ie, python2.7-config

Then, I would manually edit the file posix-ap2X.mk.in so that it contains the following:

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.

Edit: oh, also, be sure that you use the correct python-config and that you specify which Python interpreter to use as necessary. 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). In fact, simply specifying the correct Python interpreter might cause the included configure script to do its job correctly.

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. 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. Provide the details of the actual 'configure' script command line when you ran it and tell us where your self installed Python actually lives. Also make sure you run 'make distclean' to clear out the results of any old build in case that is confusing things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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