Ubuntu - Linking boost.python - Fatal error: pyconfig cannot be found

后端 未结 7 799
走了就别回头了
走了就别回头了 2020-12-08 04:28

Having some issues, now I have read the following:

hello world python extension in c++ using boost?

I have tried installing boost onto my desktop, and, done

相关标签:
7条回答
  • 2020-12-08 04:40

    I had a similar experience when building boost for centos7. I was not able to find pyconfig.h on my system only pyconfig-64.h.

    After searching around I found that you need to install python-devel to get pyconfig.h

    0 讨论(0)
  • For CentOS do this: yum install python-devel. Then try again.

    0 讨论(0)
  • 2020-12-08 04:46

    In my case, I had to create a soft link in my dir /usr/include/

    ln -s python3.5m python3.5
    

    the probleme was that i was using python 3.5 but only the python3.5m directory was existing so it wasn't able to find the pyconfig.h file.

    0 讨论(0)
  • 2020-12-08 04:50

    I just had the same error, the problem is g++ can't find pyconfig.h(shocking, I know). For me this file is located in /usr/include/python2.7/pyconfig.h so appending -I /usr/include/python2.7/ should fix it, alternatively you can add the directory to your path with:

    export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/python2.7/"
    

    You can also add this to your .bashrc and it will be added whenever you start your shell next(you will have to reopen your terminal to realize the changes).

    You can find your own python include path by using find /usr/include -name pyconfig.h, in my case this returns:

    /usr/include/python2.7/pyconfig.h
    /usr/include/i386-linux-gnu/python2.7/pyconfig.h
    
    0 讨论(0)
  • 2020-12-08 04:50

    There two possible causes for this symptom: 1. you don't have python-dev installed. 2. you have python-dev installed and your include path is incorrectly configured, which the above posting provide a solution. In my case, I was installing boost, and it is looking for the pyconfig.h header file that is missing in my ubuntu:

    The solution is

    apt-get install python-dev
    

    In other linux flavors, you have to figure out how to install python header.

    0 讨论(0)
  • 2020-12-08 04:52

    In case you have multiple Python installations, the sysconfig module can report the location of pyconfig.h for a given installation.

    $ /path/to/python3 -c 'import sysconfig; print(sysconfig.get_config_h_filename())'
    /path/to/pyconfig.h    
    
    0 讨论(0)
提交回复
热议问题