我正在按照这里的说明进行操作:http://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/
逐行执行,除了安装python3的那一行。我创建了一个虚拟环境,在虚拟环境中执行了以下四个命令:
$ 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
我猜这意味着未正确安装,但我不确定哪里出了问题?此外,我应该补充说明,我的mac上没有安装anaconda,所以这不可能是问题所在。然而,今天早些时候我有安装过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
cmake
,还有 boost 和 boost-python。 - xiaolingxiaocmake
、boost
和boost-python
。我成功地安装了dlib
,而且安装速度非常快。我已经编辑了上面的问题,以便展示快速安装后我收到的消息。 - xiaolingxiaofrom .dlib import * __version__ = "19.4.0"
代码吗?我感到困惑,因为它似乎正在尝试在Python2.7中查找图像,但看起来你已经正确安装了所有内容。 - cosinepenguinipython
后,我所做的就是import dlib
。然后错误就出现了。 - xiaolingxiaoexport DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/usr/lib:/Developer/NVIDIA/CUDA-7.0/lib:
,因为似乎错误来自于Library not loaded: @rpath/libmkl_rt.dylib
。当我在网上查找时,我发现了这个:Make runtest failure。希望这对你有用! - cosinepenguin