0

I'm good at Python programming.I'm trying to extend python with my own c programs. I've got some tutorials but my operating system is pretty lame. It says that

python.h is not found

Also I've tried OpenGL programming in it. I had to face similar error

GL/gl.h not found

I think I don't have GL dev-library on my Linux. But I'm damn sure that python.h is on my Hard drive, because I've found it in the proper directory.

I'm using PCLinux OS 2010 Dell Vostro 1510 with Intel 1.8GHz Q2duo
2Gb ram
gcc4.4.1

I can't use Swig on windows because I couldn't install gcc on it. Swig wont run on my current OS. If I write the code by myself, it shows this kind of error. (I'm sure of the code's integrity because it was an example file)

Please tell me the procedure to compile a .so file for extending python in my current OS
OR
Please tell me which OS works best for this kinda programming stuff.
OR
Tell me if How I can install all the features into Windows for this work.
OR
Is there an IDE which can help me out with this kinda problem.

Please Help me. I've been scratching my head for pretty long time trying to do this. I'm tired of idealized tutorials which assume of ideal functional computer where every thing works. Thank you

I'm not an expert programmer. But I've done some pretty interesting things. I have learn programming on turbo c++.gcc is little new to me. Please consider my novice question.

Prasad S Deshpande
  • 1,248
  • 4
  • 13
  • 33
G Sree Teja Simha
  • 441
  • 1
  • 6
  • 14

2 Answers2

6

As far as compiling the stuff on PCLinux goes, it seems that you're indeed missing the header files.

You need to install them via the package manager:

sudo apt-get install python-devel
sudo apt-get install libnvidia-xorg1-devel

This will install the python headers, the OpenGL headers.

As far as getting the stuff to run on windows goes, you'll need to setup a posix environment (either cygwin or mingw) in order to be able to use gcc there, more on that topic can be found in this question:
What is the difference between Cygwin and MinGW?

Update
I read a bit about PCLinuxOS, it seems to be pretty bad, that means it's missing a lot of stuff from its repositories.

My suggestion to you is to use Ubuntu for development since:

  1. Ubuntu's user base is a lot bigger than the one of PCLinux
  2. Many people here do active development on Ubuntu
  3. Ubuntu's repositories are a lot better maintained and there's nearly nothing one can't get via apt
  4. Therefore getting your python c extension to run there will be trivial
  5. And last but not least future questions will get a lot more answers due to the above facts, and if you got problems with Ubuntu itself there's even a stackexchange site

Using a good development environment saves you a lot of time and headaches.

Update 2 Installing the headers on Ubuntu

sudo apt-get install python-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install libglew1.5-dev

This will install python headers, OpenGL headers, OpenGL utility headers and OpenGL extensions headers.

Community
  • 1
  • 1
Ivo Wetzel
  • 44,463
  • 14
  • 89
  • 109
1

In my experience, you need to have the Python development libraries installed on your system and you extend Python by writing your C code then compiling that C code using the Python interpretor. See for example the article How to extend Python.

Chris
  • 39,262
  • 15
  • 126
  • 145