fatal error: pyconfig.h: No such file or directory找不到pyconfig.h文件---解决对策

来源:互联网 发布:固定收益 知乎 编辑:程序博客网 时间:2024/06/07 13:01


caffe配置python和matlab接口是,出现fatal  error: pyconfig.h: No such file or directory找不到pyconfig.h文件的错误。出错的文件为wrap_python.hpp。

1.首先确认caffe工程的CommonSettings.props中Python路径是否正确。正确设定的情况下,在wrap_python.hpp中,鼠标放在#include的pyconfig.h上,右键能够打开pyconfig.h文件。


2.卤煮在1可以正常打开pyconfig.h的情况下,仍然报fatal  error: pyconfig.h: No such file or directory找不到pyconfig.h文件的错误。

此时可以对解决方案进行清理,重新生成,卤煮执行这步,出现过成功案例。


3.当过了一一段时间(一两个月吧),因为其他变更,再次编译caffe时,这个错误又卷土重来,执行完1和2,错误仍然没能解决。这次对CommonSettings.props中Python路径中include的选项中,追加了绝对路径。神奇的事情出现了,生成时没有错误了!卤煮表示很惊讶。

最终CommonSettings.props中Python路径设定如下:

  </PropertyGroup>
    <PropertyGroup Condition="'$(PythonSupport)'=='true'">
        <PythonDir>C:\ProgramData\Anaconda2</PythonDir>
        <LibraryPath>$(PythonDir)\libs;$(LibraryPath)</LibraryPath>
        <IncludePath>$(PythonDir)\include;C:\ProgramData\Anaconda2\include;$(IncludePath)</IncludePath>


阅读全文
0 1
原创粉丝点击