Python.h: No such file or directory

后端 未结 6 1965
误落风尘
误落风尘 2020-12-23 13:12

I recently installed KDevelop 4 for C++ development on my Macbook Pro running Ubuntu 12.04 LTS.

I want to embed Python application in my C++ code. To do that, one ne

6条回答
  •  余生分开走
    2020-12-23 13:52

    Most likely Python.h is not in your build systems' include path. You can find out where your Python.h is by running

    dpkg -L python-dev | grep Python.h
    

    This will also verify that the python-dev package actually installed a Python.h.

    I don't have a kdevelop here, but most IDEs have a setting somewhere where you can specify the include path used by the build system, and you should be able to add the path where Python.h lies there.

    EDIT:

    As Nikolai implied, you will also need to add the correct library path for the linking stage. (Output of python-config --ldflags).

提交回复
热议问题