python - 致命错误:Python.h 没有这样的文件或目录 - 但已经安装了 python-dev
问题描述
我正在尝试在 Ubuntu 上安装 mod_wsgi。当按照 mod_wsgi 网站上的描述运行“sudo make”命令时,我收到错误:
src/server/wsgi_python.h:24:10: fatal error: Python.h: No such file or directory
SO ( 1 , 2 , 3 ) 上的mod_wsgi 故障排除部分和其他帖子说要安装正确版本的 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
所以他们应该使用相同的环境变量(我的理解)。
有人对下一步有什么建议吗?
解决方案
要添加到上面的答案(因为我很固执),我会注意到您必须python[3]-dev
安装包(这是提供的包Python.h
)。在 ubuntu 上,apt install python3-dev
为我解决了这个问题。
推荐阅读
- php - 如何使用 laravel 在 db 中插入多数组值
- javascript - 如何在 javascript 中获取设备信息和浏览器信息?
- laravel - 完成所有关系后如何自动更新状态?
- javascript - 如何从刺痛中获取数组?
- google-sheets - 如果某个单元格有日期,则停止公式
- sql - 使用 For 循环在 SQL 查询中交替使用一组 ID
- android - 为 ListView 错误“T”参数创建搜索过滤器
- php - Laravel schedule:run 在添加到 cron 作业时不起作用
- c# - 我想每 60 秒将最小数字增加 5,并且不能超过 Xamarin/C# 中的最大数字
- android - 可以在改造android中调整界面吗?