Missing Python.h in Arch

I use Arch Linux. I want to compile a C++ file that includes <Python.h>.
But I can’t do it.

In Debian based systems this problem is resolved with sudo apt-get install python-dev. How I can install this package with pacman?

* EDIT *

I wan’t to compile this file


#include "Python.h"
int main(int argc, char *argv[])
  Py_SetProgramName(argv[0]);  /* optional but recommended */
  PyRun_SimpleString("from time import time,ctimen"
                     "print 'Today is',ctime(time())n");
  return 0;

run this command:

g++ C.c

and i have this error:

call_function.c:1:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
compilation terminated.
Asked By: Vahid Kharazi


You should compile your files with libs and cflags provided by python package:

gcc py.c $(pkg-config --cflags --libs python2) -o py

Besides, it should be #include <Python.h> instead.

Answered By: daisy
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.