Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cython installation does not find the Python.h file?

Tags:

python

cython

I wanted to install cython on my ubuntu 12.04 and I entered in the terminal

sudo easy_install cython

in response, I get the following 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  

sorry for the catalan in here but El fitxer o directori no existeix means that the file doesn't exist

i think that i perhaps miss something or i don't know

does anyone else have the same problem? or know how to install it correctly?

like image 400
mid_kid Avatar asked Apr 23 '12 14:04

mid_kid


People also ask

Where is python h file located?

The header files are typically installed with Python. On Unix, these are located in the directories prefix/include/pythonversion/ and exec_prefix/include/pythonversion/ , where prefix and exec_prefix are defined by the corresponding parameters to Python's configure script and version is '%d.

What is python H?

Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications.


1 Answers

depending on how you installed python, you may need to get the dev files as well (if you installed with apt-get or Synaptic).

sudo apt-get install python-dev

or maybe

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

Note that this is necessary if you need to install any C extensions to Cpython.

like image 71
mgilson Avatar answered Oct 01 '22 02:10

mgilson