首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cython安装找不到Python.h文件?

Cython安装找不到Python.h文件?
EN

Stack Overflow用户
提问于 2012-04-23 22:25:04
回答 2查看 8.2K关注 0票数 8

我想在我的ubuntu 12.04上安装cython,于是我进入了终端

代码语言:javascript
复制
sudo easy_install cython

作为响应,我得到以下错误:

代码语言:javascript
复制
Searching for cython  
Reading http://pypi.python.org/simple/cython/  
Reading http://www.cython.org  
Reading http://cython.org  
Best match: Cython 0.16  
Downloading http://www.cython.org/release/Cython-0.16.zip  
Processing Cython-0.16.zip  
Running Cython-0.16/setup.py -q bdist_egg --dist-dir /tmp/easy_install-VzJ0lH/Cython-0.16/egg-dist-tmp-BMJs3p  
Compiling module Cython.Plex.Scanners ...  
Compiling module Cython.Plex.Actions ...  
Compiling module Cython.Compiler.Lexicon ...  
Compiling module Cython.Compiler.Scanning ...  
Compiling module Cython.Compiler.Parsing ...  
Compiling module Cython.Compiler.Visitor ...  
Compiling module Cython.Compiler.FlowControl ...  
Compiling module Cython.Compiler.Code ...  
Compiling module Cython.Runtime.refnanny ...  
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'  
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'  
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'  
warning: no files found matching '*.pxd' under directory 'Cython/Utility'  
warning: no files found matching '*.h' under directory 'Cython/Utility'  
warning: no files found matching '.cpp' under directory 'Cython/Utility'  
/tmp/easy_install-VzJ0lH/Cython-0.16/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: El fitxer o directori no existeix  
compilation terminated.  
error: Setup script exited with error: command 'gcc' failed with exit status 1  

很抱歉这里的加泰罗尼亚语,但是El fitxer o directori no existeix表示该文件不存在

我想我可能漏掉了什么或者我不知道

其他人也有同样的问题吗?或者知道如何正确安装它?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-04-23 22:55:54

根据您安装python的方式,您可能还需要获取dev文件(如果使用apt-get或Synaptic安装)。

代码语言:javascript
复制
sudo apt-get install python-dev

或者也许

代码语言:javascript
复制
sudo apt-get install python2.6-dev  #substitute your python version here...

请注意,如果您需要为Cpython安装任何C扩展,则这是必要的。

票数 11
EN

Stack Overflow用户

发布于 2012-04-23 22:38:46

我记得在安装Cython时遇到过这个问题。如果转到Python安装文件夹(假设本例为Python2.7 ),请将C:\Python27\include目录及其所有内容复制到主目录或运行easy_install的目录。"include“目录包含"python.h",这是编译器的C头文件。

也就是说,当我这样做时,它消除了那个错误,但仍然不起作用。

有点像博纳。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10282470

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档