繁体   English   中英

在Mac OSX 10.10上安装Dlib for python时遇到问题

[英]Trouble installing Dlib for python on Mac OSX 10.10

我正在尝试在我的计算机上安装dlib-18.16 for python(运行Mac OSX 10.10)。 我已经安装了升级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,并发现它们在anaconda安装的python中的一些.h文件中声明(当查看dlib_build文件时,安装程​​序似乎找到了anaconda安装)。 有没有人有任何想法如何解决这个问题?

我意识到我必须进入CMakeCache.txt文件并手动将X11路径从anaconda更改为usr / X11,因为anaconda版本的X11 .h文件缺少某些XQuartz函数。 现在一切都有效。

我在PyPi( 19.4.0 )中的版本遇到了这个问题。 直接从源码安装( 19.4.99 )似乎工作。

所以这两个版本之间的东西解决了这个问题。

从源代码安装的命令:

git clone https://github.com/davisking/dlib.git
cd dlib
pip install .

仅供参考,这里是我系统中的Xlib.h文件,因为推测它是在拾取不同版本的XLib.h而没有这些符号。

使用Python 2.7在OS-X 10.11.4上运行。 我绝对安装了XQuartz。

$ mdfind -name Xlib.h
/usr/local/Cellar/dlib/19.4/share/doc/dlib/docs/dlib/gui_core/xlib.h.html
/usr/local/Cellar/dlib/19.4/include/dlib/gui_core/xlib.h
/Users/<username>/Workspace/dlib/dlib/gui_core/xlib.h
/System/Library/Frameworks/Tk.framework/Versions/8.4/Headers/X11/Xlib.h
/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/Xlib.h
/opt/X11/include/X11/Xlib.h
/opt/X11/include/cairo/cairo-xlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/8.4/Headers/X11/Xlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/Xlib.h

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM