如何安装python开发包?

Dav*_*vid 37 python linux mod-wsgi amazon-ec2

我想去mod_wsgi 3.3上班.当我运行make它告诉我,我错过了Python开发人员包.如何获取和安装Python开发人员包?

我得到的错误如下:

mod_wsgi.c:135:20: error: Python.h: No such file or directory
mod_wsgi.c:138:2: error: #error Sorry, Python developer package does not appear to be installed.
mod_wsgi.c:142:2: error: #error Sorry, mod_wsgi requires at least Python 2.3.0 for Python 2.X.
mod_wsgi.c:150:2: error: #error Sorry, mod_wsgi requires that Python supporting thread.
mod_wsgi.c:153:21: error: compile.h: No such file or directory
mod_wsgi.c:154:18: error: node.h: No such file or directory
mod_wsgi.c:155:20: error: osdefs.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

系统(Amazon EC2实例)

  • Apache 2.2.16(Unix)
  • 亚马逊Linux(Red Hat 4.4.4-13)AMI测试版2011.02
  • Python 2.6.6

Dav*_*vid 72

yum install python-devel 将工作.

如果yum不起作用则使用

apt-get install python-dev

  • 小不适合未来的用户,我使用的是 python3.7 的 venv(非默认的 python3.8),我必须运行 `sudo apt install python3.7-dev` (6认同)

ben*_*man 9

如果你使用yum搜索,你可以找到你的python版本的python开发包.

对我来说,我使用的是python 3.5.我跑了以下

yum search python | grep devel
Run Code Online (Sandbox Code Playgroud)

其中返回以下内容

在此输入图像描述

然后我能够使用以下cmd为我的python版本安装正确的包.

sudo yum install python35u-devel.x86_64
Run Code Online (Sandbox Code Playgroud)

这适用于你需要使用apt-get的ubuntu或debian的centos


Dat*_*ker 8

对我来说,上面提到的包都没有帮助.

我终于lxml在运行后设法安装:

sudo apt-get install python3.5-dev
Run Code Online (Sandbox Code Playgroud)

  • 用于 python3.8 的 `sudo apt-get install python3.8-dev` (2认同)