在 Amazon linux 2 上使用 python 3.11 编译 mod_Wsgi:致命错误:Python.h:没有这样的文件或目录

问题描述 投票:0回答:1

完整输出:

In file included from src/server/mod_wsgi.c:22:0:
src/server/wsgi_python.h:26:10: fatal error: Python.h: No such file or directory
 #include <Python.h>
          ^~~~~~~~~~
compilation terminated.
apxs:Error: Command failed with rc=65536

.
make: *** [src/server/mod_wsgi.la] Error 1

我一直在尝试使用

make
使用 python 3.11 编译 mod_wsgi 但无济于事。我已经安装了
python3-devel
,但看起来
Python.h
没有安装在正确的位置或其他什么地方?我什至尝试将
Python.h
复制到与正在查找它的代码相同的目录中,即
src/server/

我也确保使用

enable-shared
编译 Python。

这个文件到底应该位于哪里以及如何获取它?我希望有一个

python311-devel
我可以安装,但最多只有
python34-devel

提前谢谢您

python mod-wsgi amazon-linux
1个回答
0
投票

我在需要 thriftpy2 的 pip 安装中遇到了类似的问题。

似乎对我有用的解决方法是扩展 gcc 环境变量的可见性,如下所示:

export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include/python3.7m/
© www.soinside.com 2019 - 2024. All rights reserved.