Re: Missing Python.h
Robert Bradshaw <robertwb <at> math.washington.edu>
2011-03-04 20:10:14 GMT
On Fri, Mar 4, 2011 at 12:00 PM, Hector <hector1618 <at> gmail.com> wrote:
> On Wed, Jan 19, 2011 at 10:01 AM, Robert Bradshaw
> <robertwb <at> math.washington.edu> wrote:
>> On Tue, Jan 18, 2011 at 7:44 PM, Hector troy <hector1618 <at> gmail.com> wrote:
>> > Hello everyone,
>> > I am a newbie to Cython and tried to run first program with Cython. It
>> > converted .pyx file into .c file but when I tried to run .c file with
>> > gcc it
>> > gave me following error.
>> > $hector <at> hector:~/Desktop/Programs/Cython$ time gcc test1.c
>> > test1.c:4: fatal error: Python.h: No such file or directory
>> > compilation terminated.
>> > I tried to update Python2.6-dev but its already in the newest form.
>> > Any help regarding the same will be very helpful.
>> For someone just getting started, I would suggest using distuitls via
>> a setup.py file or using pyximport. There are a slew of options that
>> you need to pass gcc, many of which depend on your platform and/or how
>> Python was compiled.
>> - Robert
> Hi Robert,
> I tried and made setup.py files and can run my code with it. It is nice but
> kind of irritating to write setup.py files for everything.
Once you have one, you can copy it from there. In fact if you use
http://wiki.cython.org/enhancements/distutils_preprocessing then you
can almost have a single setup.py for all your projects. Pyximport is
supposed to make this easier, and is great when it works, but hard to
debug when it doesn't.
> And I can't look time improvement with all imports.
I'm not following you here.
> Can you please give me some hint or reference where to start looking for
> missing Python.h or for starting with gcc?
If you run the setup.py file, it prints out the various gcc commands
it uses with all the gory flags. You can then use those directly if
you think that's easier. Note, however, that the exact flags and paths
to use vary from system to system.