swoole / phpy

Connecting the Python and PHP ecosystems together
Apache License 2.0
539 stars 44 forks source link

Python.h: No such file or directory #50

Closed fishfree closed 5 months ago

fishfree commented 5 months ago

sudo make install报错:

libtool: compile:  g++ -I. -I/home/mememe/phpy -I/home/mememe/phpy/include -I/home/mememe/phpy/main -I/home/mememe/phpy -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib -I/opt/miniconda3/include/python3.11 -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -z now -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /home/mememe/phpy/src/bridge/core.cc -MMD -MF src/bridge/core.dep -MT src/bridge/core.lo  -fPIC -DPIC -o src/bridge/.libs/core.o
In file included from /home/mememe/phpy/src/bridge/core.cc:18:
/home/mememe/phpy/include/phpy.h:21:10: fatal error: Python.h: No such file or directory
   21 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:213: src/bridge/core.lo] Error 1
fishfree commented 5 months ago

找到了解决方法:

phpize
which python3.11-config
./configure --with-python-config=/home/mememe/miniconda3/bin/python3.11-config
sudo make install