cmake 增加 Python.h 依赖

创建日期: 2024-04-19 09:44 | 作者: 风波 | 浏览次数: 17 | 分类: C++

来源:https://stackoverflow.com/questions/11041299/python-h-no-such-file-or-directory

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
target_link_libraries(<your exe or lib> ${PYTHON_LIBRARIES})

安装 python-dev

来源:https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory

sudo apt-get install python-dev   # for python2.x installs
sudo apt-get install python3-dev  # for python3.x installs

其它版本

sudo apt install libpython3.6-dev 
sudo apt install libpython3.8-dev 
sudo apt install libpython3.9-dev
sudo apt install libpython3.10-dev
sudo apt install libpython3.11-dev
sudo apt install libpython3.12-dev
sudo yum install python-devel    # for python2.x installs
sudo yum install python3-devel   # for python3.x installs
sudo dnf install python2-devel  # for python2.x installs
sudo dnf install python3-devel  # for python3.x installs
sudo zypper in python-devel   # for python2.x installs
sudo zypper in python3-devel  # for python3.x installs
# This is a departure from the normal Alpine naming
# scheme, which uses py2- and py3- prefixes
sudo apk add python2-dev  # for python2.x installs
sudo apk add python3-dev  # for python3.x installs
apt-cyg install python-devel   # for python2.x installs
apt-cyg install python3-devel  # for python3.x installs
17 浏览
13 爬虫
0 评论