【发布时间】:2017-07-18 22:19:07
【问题描述】:
为了安装 dlib,我遵循了这个教程:http://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/。 我在 Mac OS X 10.12.5 上并使用 Python 3.5。 我跑
$ brew install cmake
$ brew install boost
$ brew install boost-python --with-python3
它可以正常工作。
但是当我尝试使用 pip install dlib 安装 dlib 时。我有一个错误:
The C compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"
is not able to compile a simple test program.
error: cmake configuration failed
ld: can't map file, errno=22 file '/usr/local/opt/qt/lib' for architecture x86_64
有关完整错误,请参阅此链接(不想粘贴完整错误): https://gist.github.com/alexattia/3e98685310d90b65031db640d3ea716a
回溯错误后,当我尝试手动制作 dlib 时,我有这个:
Linking C executable cmTC_05e45
/usr/local/Cellar/cmake/3.8.2/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_05e45.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
/usr/local/opt/qt/lib CMakeFiles/cmTC_05e45.dir/testCCompiler.c.o -o
cmTC_05e45
完整的跟踪扩展:https://gist.github.com/alexattia/1e54ffb87c9eb4c811033f5cadd90331
我重新安装了 XCode(来自 Apple Store)和 CMake(来自下载页面的 3.8.2),我什至安装了 Qt Creator 以获得一个干净的 Qt 版本,但我仍然有同样的错误。
我尝试使用 conda 安装它,但安装后,我仍然没有 python 中的模块。
非常感谢您的帮助。
【问题讨论】:
-
您的具体问题是 - 什么?
-
我该如何解决这个问题并安装 dlib ?
-
日志中的关键错误行是
ld: can't map file, errno=22 file '/usr/local/opt/qt/lib' for architecture x86_64(也就是说,该行应该在问题帖子中本身)。有人将目录/usr/local/opt/qt/lib传递给链接器,链接器将其视为链接文件。可能,你有指定的环境变量。 -
我编辑了我的帖子以添加该行。事实上,在我的
.bash_profile中,我有export LDFLAGS="/usr/local/opt/qt/lib"、export CPPFLAGS="/usr/local/opt/qt/include"、export PATH="/usr/local/opt/qt/bin:$PATH"。但即使在评论它时,我仍然有同样的错误。