首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >affdex.cpp:9:31:致命错误: pybind11/pybind11.h:没有这样的文件或目录#include

affdex.cpp:9:31:致命错误: pybind11/pybind11.h:没有这样的文件或目录#include
EN

Stack Overflow用户
提问于 2017-09-25 08:47:38
回答 2查看 1.4K关注 0票数 1

我可以在Python语言中导入pybind11,它位于包含路径中。但是,按照here的说明,我得到了以下错误

代码语言:javascript
运行
复制
(venv)[jalal@ivcgpu1 affdex-sdk-py]$ python
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybind11
>>> pybind11.get_include()
'/home/grad3/jalal/venv/include/site/python2.7'
>>> pybind11.get_include(True)
'/home/grad3/jalal/venv/include/site/python2.7'
>>> quit()
(venv)[jalal@ivcgpu1 affdex-sdk-py]$ c++ -O3 -shared -std=c++11 -fPIC -Wl,--no-as-needed -I$AFFDEX_SDK_HOME/include -I$HOME/venv/include/site/python2.7 `python-config --cflags --ldflags --libs` -Wl,--no-as-needed -laffdex-native -L$AFFDEX_SDK_HOME/lib affdex.cpp -o affdex.so
affdex.cpp:9:31: fatal error: pybind11/pybind11.h: No such file or directory
 #include <pybind11/pybind11.h>
                               ^
compilation terminated.
(venv)[jalal@ivcgpu1 affdex-sdk-py]$ 

如何修复此错误?

更新:

代码语言:javascript
运行
复制
(venv)[jalal@ivcgpu1 affdex-sdk-py]$ echo $HOME
/home/grad3/jalal
(venv)[jalal@ivcgpu1 affdex-sdk-py]$ echo $HOME/venv/include/site/python2.7
/home/grad3/jalal/venv/include/site/python2.7
EN

回答 2

Stack Overflow用户

发布于 2020-02-16 20:11:37

在尝试为pypy安装scipy时,我看到了以下错误消息

代码语言:javascript
运行
复制
  scipy/fft/_pocketfft/pypocketfft.cxx:15:31: fatal error: pybind11/pybind11.h: No such file or directory
   #include <pybind11/pybind11.h>
                                 ^
  compilation terminated.
  scipy/fft/_pocketfft/pypocketfft.cxx:15:31: fatal error: pybind11/pybind11.h: No such file or directory
   #include <pybind11/pybind11.h>

修复方法是:

代码语言:javascript
运行
复制
$ python -m pip install pybind11
票数 0
EN

Stack Overflow用户

发布于 2021-07-15 20:29:45

您是否尝试在您的编译命令中添加include目录?

-I/[pathToPython]/Lib/site-packages/pybind11/include一样

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46396204

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档