我想在Ubuntu上安装mod_wsgi。当运行“sudo make”命令as described on the mod_wsgi website时,我收到错误:
src/server/wsgi_python.h:24:10: fatal error: Python.h: No such file or directory
mod_wsgi troubleshoot section和SO上的其他帖子(1,2,3)说要安装正确版本的python-dev。这已经基于以下输出完成。 Python3运行3.6.7和apt-get说python3-dev是最新版本的3.6.7。
$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
$ sudo apt-get install python3-dev
...
python3-dev is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
所以似乎Python.h文件就在那里,但make
找不到它。我查看了这篇SO帖子(4),但我不认为它适用于我,因为我能够找到Python.h。
$ locate Python.h
/usr/include/python3.6m/Python.h
我不确定下一步该怎么做。安装了Python3.6-dev,我可以找到Python.h,但是make
不能。我正在使用Pycharm为我自动创建的一个venv,我有预感它涉及到这个问题,但我不确定如何跟进这个预感。我在与make
和python3
相同的终端上运行apt-get
所以他们应该使用相同的环境变量(是我的理解)。
有关下一步的任何人的建议吗?
我为mod_wsgi运行./configure
并看到输出checking for python... /usr/bin/python
。当我运行locate Python.h
时,它给了我/usr/include/python3.6m/Python.h
。所以看起来配置找到了错误的python版本。然后我按照./configure --with-python=/usr/bin/python3.6m
的建议跑了the mod_wsgi documentation。现在运行make
是成功的。
我后来发现这是安装mod_wsgi的更难的方法。我最后只是跟随this tecadmin guide说要运行命令sudo apt-get install libapache2-mod-wsgi
。这就是我所做的,mod_wsgi现在正在使用apache。