【问题标题】:Trouble installing Dlib for python on Mac OSX 10.10在 Mac OSX 10.10 上安装 Dlib for python 时遇到问题
【发布时间】:2015-11-01 02:37:37
【问题描述】:

我正在尝试在我的计算机上安装 dlib-18.16 for python(运行 Mac OSX 10.10)。我已经安装了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 安装)。有没有人对如何解决这个问题有任何想法?

【问题讨论】:

    标签: python c++ x11 dlib


    【解决方案1】:

    我意识到我必须进入 CMakeCache.txt 文件并手动将 X11 路径从 anaconda 更改为 usr/X11,因为 X11 .h 文件的 anaconda 版本缺少其中一些 XQuartz 功能。现在一切正常。

    【讨论】:

    • 嗨,你能显示确切的文件和 X11 路径,你改变了吗?有两个 CMakeCache 文件:dlib/examples/build/CMakeCache.txtdlib/tools/python/build/CMakeCache.txt?谢谢!
    【解决方案2】:

    我在 PyPi (19.4.0) 中遇到了这个问题。 直接从源代码安装 (19.4.99) 似乎可行。

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

    从源代码安装的命令:

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

    仅供参考,这是我系统上的 Xlib.h 文件,因为假设它正在选择没有这些符号的不同版本的 XLib.h。

    在 OS-X 10.11.4 和 Python 2.7 上运行。我肯定安装了 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
    

    【讨论】:

      猜你喜欢
      • 2012-10-29
      • 2012-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-08
      • 1970-01-01
      • 2018-03-12
      • 2019-11-23
      相关资源
      最近更新 更多