【问题标题】:Cannot install dlib on mac os X无法在 mac os X 上安装 dlib
【发布时间】:2017-11-02 19:00:43
【问题描述】:

我正在按照这里的说明进行操作:http://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/

逐行,除了为安装python3的那一行。我做了一个虚拟环境,在 virtualenv 里面,做了这四行:

$ pip install numpy
$ pip install scipy
$ pip install scikit-image
$ pip install dlib

与说明不同,最后一行需要几秒钟,而不是 15 分钟。安装完后打开ipython,试了import dlib,收到这样的信息:

----> 1 from .dlib import *
      2 __version__ = "19.4.0"

ImportError: dlopen(/Users/myname/Documents/camera-project/code/story-board/cv/lib/python2.7/site-packages/dlib/dlib.so, 2): Library not loaded: @rpath/libmkl_rt.dylib
  Referenced from: /Users/myname/Documents/camera-project/code/story-board/cv/lib/python2.7/site-packages/dlib/dlib.so
  Reason: image not found

我认为这意味着dlib 没有正确安装,但我不确定我做错了什么?

另外,我应该补充一点,我的 mac 上没有anaconda,所以这不是问题。但是今天早些时候我做到了,我可以毫无问题地加载dlib,大概是因为我正在运行anaconda 分发的python 版本,我假设dlib 带有anaconda。然而,anaconda 分发的 X11 已损坏,因此我必须从系统中完全删除 anaconda 并重新开始。

编辑

这是我“成功”安装 dlib 后收到的消息:

    :/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Installing collected packages: dlib
Successfully installed dlib-19.4.0

【问题讨论】:

    标签: python dlib


    【解决方案1】:

    您可能需要安装软件包 cmake。

    当我刚刚尝试在我的 Mac 上的 virtualenv 中安装 dlib 时,我收到了错误

    running bdist_wheel
      running build
      error: Cannot find cmake, ensure it is installed and in the path.
      You can install cmake on OSX using `sudo brew install cmake`.
      You can also specify its path with --cmake parameter.
    

    所以我建议尝试安装 cmake

    brew install cmake
    

    【讨论】:

    • 我已经安装了cmake,还有boost。和 boost-python
    • 您是否在 virtualenv 中安装了 cmake?当您尝试运行 pip install dlib 时是否还有任何错误,或者它似乎安装得很快?
    • 不,我在 virtualenv 之外安装了cmake, boost, boost-python。而且我很好地安装了 dlib,它安装得非常快。我为快速安装后收到的消息编辑了上面的问题。
    • 嗯。您是否在 python2 环境中运行from .dlib import * __version__ = "19.4.0" 代码?我很困惑,因为它似乎试图在 python2.7 中找到图像,但看起来你已经正确完成了所有安装。
    • 所以在我输入virtualenv并打开ipython之后,我所做的只是import dlib。然后错误弹出。
    猜你喜欢
    • 2016-07-05
    • 2011-01-02
    • 2011-05-04
    • 2012-10-24
    • 2014-04-29
    • 2019-04-06
    • 2013-11-02
    相关资源
    最近更新 更多