我正在尝试在我的计算机(运行 Mac OSX 10.10)上为 python 安装 dlib-18.16。我安装了 boost python 和 X11,但在下载文件后按照说明运行 ./compile_dlib_python_module.bat 时遇到了麻烦。
我得到的错误很多,但看起来像这样
[ 1%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.o
In file included from /Users/xxx/Downloads/dlib-18.16/dlib/gui_widgets/fonts.cpp:14:
/Users/xxx/Downloads/dlib-18.16/dlib/gui_widgets/nativefont.h:313:21: error: use
of undeclared identifier 'XAllocColor'
XAllocColor(d, cmap, &xcol);
这会持续一段时间并以
结束/Users/xxx/Downloads/dlib-18.16/dlib/gui_widgets/nativefont.h:400:21: error: use
of undeclared identifier 'XFillRectangle'
XFillRectangle(d, pix, gc, 0, 0, width, height);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.o] Error 1
make[1]: *** [dlib_build/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2
我检查了一些缺失的函数,如 XFillRectangle,并发现它们在 python 的 anaconda 安装中的一些 .h 文件中声明(在查看 dlib_build 文件时,安装程序似乎已经找到了 anaconda 安装)。有没有人对如何解决这个问题有任何想法?
最佳答案
我意识到我必须进入 CMakeCache.txt 文件并手动将 X11 路径从 anaconda 更改为 usr/X11,因为 X11 .h 文件的 anaconda 版本缺少其中一些 XQuartz 函数。现在一切正常。
关于python - 在 Mac OSX 10.10 上为 python 安装 Dlib 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31898245/