简体   繁体   中英

configure: error: Python.h not found when it exists in Ubuntu 18

I am trying to run a ./configure --with-python file (I can attach it but it's long) and I am getting these errors:

checking for gtest-config... no
File "<string>", line 1
import distutils.sysconfig; bl = distutils.sysconfig.get_config_var('BLDLIBRARY'); print bl if bl   else '-lpython2.7'
                                                                                              ^
SyntaxError: invalid syntax
File "<string>", line 1
import distutils.sysconfig; print distutils.sysconfig.get_config_var('INCLUDEPY')
                                              ^
SyntaxError: invalid syntax
checking Python.h usability... no
checking Python.h presence... no
checking for Python.h... no
configure: error: Python.h not found. Please install the devel package.

Next step, I run: locate Python.h which gives me:

/usr/include/python2.7/Python.h
/usr/include/python3.6m/Python.h
/usr/include/python3.7m/Python.h

Next step, I run each of these:

./configure --with-python=/usr/bin/python2.7
./configure --with-python=/usr/bin/python3.6m
./configure --with-python=/usr/include/python3.6m/Python.h

With no luck.

Any pointers on where the error can be? Thank you very much!

You are missing CFLAGS

./configure --with-python=/usr/bin/python2.7 CFLAGS="-I/usr/include/python2.7/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM