Linux 如何安装python开发包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6230444/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 01:01:07  来源:igfitidea点击:

How to install python developer package?

pythonlinuxamazon-ec2mod-wsgi

提问by David

I am trying to get mod_wsgi 3.3to work. When I run makeit is telling me that I am missing the Python developer package. How do I get and install the Python developer package?

我正在努力mod_wsgi 3.3上班。当我运行时,make它告诉我我缺少 Python 开发人员包。如何获取和安装 Python 开发包?

The error I get is as follows:

我得到的错误如下:

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

System (Amazon EC2 instance)

系统(Amazon EC2 实例)

  • Apache 2.2.16 (Unix)
  • Amazon Linux(Red Hat 4.4.4-13) AMI Beta Version 2011.02
  • Python 2.6.6
  • Apache 2.2.16 (Unix)
  • Amazon Linux(Red Hat 4.4.4-13) AMI Beta 版 2011.02
  • 蟒蛇 2.6.6

采纳答案by David

yum install python-develwill work.

yum install python-devel将工作。

If yumdoesn't work then use

如果yum不起作用,则使用

apt-get install python-dev

apt-get install python-dev

回答by Datalker

For me none of the packages mentioned above did help.

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

I finally managed to install lxmlafter running:

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

sudo apt-get install python3.5-dev

回答by ben jarman

If you use yum search you can find the python dev package for your version of python.

如果您使用 yum 搜索,您可以找到适用于您的 Python 版本的 Python 开发包。

For me I was using python 3.5. I ran the following

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

yum search python | grep devel

Which returned the following

返回以下内容

enter image description here

在此处输入图片说明

I was then able to install the correct package for my version of python with the following cmd.

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

sudo yum install python35u-devel.x86_64

This works on centos for ubuntu or debian you would need to use apt-get

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