我正在尝试在我的 ubuntu 上构建 boost python 库。但是,当我执行
./b2 --with-python
它总是返回与我相关的错误
./boost/python/detail/wrap_python.hpp:57:11: fatal error: pyconfig.h: No such file or directory
# include <pyconfig.h>
^~~~~~~~~~~~
我尝试在网上查找,例如,https://github.com/boostorg/build/issues/289
按照他们的建议检查我的“project-config.jam”
我发现
# Python configuration
import python ;
if ! [ python.configured ]
{
using python : 3.7 : /home/lowlimb/anaconda3 :/home/lowlimb/anaconda3/include/python3.7m;
}
这是正确的,因此我真的不知道如何解决这个问题。
谁能给我一些建议?
最佳答案
pyconfig.h
与 sudo apt install python-dev
一起安装
要使用特定的 python 版本构建,您可以执行
./bootstrap.sh --with-python=<path to python>
例如./bootstrap.sh --with-python=python3
使用系统的 python3 或./bootstrap.sh --with-python=$VIRTUAL_ENV/bin/python
从您的虚拟环境中使用 python。
关于python - 无法构建 boost python 库( fatal error : pyconfig. h:没有这样的文件或目录),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57244655/