无法在mac os X上安装dlib

时间:2017-06-01 14:49:16

标签: python dlib

我按照此处的说明操作: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 }。但是,由X11分发的anaconda已损坏,因此我必须从系统中完全删除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

1 个答案:

答案 0 :(得分:1)

您可能需要安装pakage cmake。

当我刚刚在virtualenv中尝试在我的Mac上安装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