2012-04-23 17 views
8

quiero instalar Cython en mi ubuntu 12.04 y me introdujo en su terminalLa instalación de Cython no encuentra el archivo Python.h?

sudo easy_install cython 

en respuesta, me sale el siguiente error:

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 

siento por el catalán aquí pero El fitxer o Directori sin existeix significa que el archivo no existe

pienso que tal vez se pierda algo o no sé

¿Alguien más tiene el mismo problema? o sabe cómo instalarlo correctamente?

Respuesta

10

dependiendo de cómo instaló Python, es posible que necesite obtener los archivos dev también (si instaló con apt-get o Synaptic).

sudo apt-get install python-dev 

o tal vez

sudo apt-get install python2.6-dev #substitute your python version here... 

Tenga en cuenta que esto es necesario si necesita instalar cualquier extensión C a CPython.

+1

Con Ubuntu 12.10 (dirigida a python2.7.5) finalmente pude (!) Hacer que este error desaparezca especificando "sudo apt-get install python2.7-dev". He estado probando solo python-dev. – fooledbyprimes

+0

@fooledbyprimes - Me alegra que lo hayas hecho funcionar ... FWIW, ni siquiera recuerdo haber escrito esta respuesta :-). Si me preguntaras cómo hacerlo hoy, probablemente me habría quedado perplejo ;-). – mgilson

0

Recuerdo haber tenido este problema al instalar Cython. Si va a la carpeta de instalación de Python (suponiendo que Python2.7 para este ejemplo), copie el directorio C: \ Python27 \ include y todos sus contenidos en su directorio de inicio o en el directorio donde está ejecutando easy_install. El directorio "incluir" contiene "python.h", que es el archivo de cabecera C para el compilador.

Dicho esto, cuando lo hice eliminó ese error, pero aún así no funcionó.

Bona tipo.

+0

Lo siento, pero no funciona para mí, estoy en Ubuntu y no tengo esa carpeta de inclusión –

Cuestiones relacionadas