安装dlib
官方文档,可查看[How to install dlib from source on macOS or Ubuntu](https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf)
安装失败:需要先安装openblas和opencv
dlib的依赖
- 之一步:dlib安装需要的依赖有openblas,opencv。可以直接使用brew安装。
$ brew install openblas $ brew install opencv
安装出现:gcc安装失败(具体显示如问题),需安装gcc:https://liheyuting.github.io/2019/01/28/install-openblas:opencv:gcc/)
- 第二步:Mac的x11
X11是执行unix程序的图形窗口环境。Mac OS X本身的程序是Aqua界面的,但是为了能够兼容unix和linux移植过来的程序(Mac OS X由BSD-UNIX修改而来),比如MatLab,就需要x11窗口环境。
运行dlib需要X11,但Mac目前没有自带X11,需要重新下载安装,[下载地址](https://www.xquartz.org/),下载后直接安装,默认安装目录为/opt/X11,需要在/usr/loca/opt目录下创建软连接,创建命令如下,创建后重启Mac。
$ cd /usr/local/opt $ ln -s /opt/X11 X11
遇到的问题:
`brew install openblas`安装时显示如下:
Warning: Your Xcode (10.0) is outdated. Please update to Xcode 10.1 (or delete it). Xcode can be updated from the App Store. Warning: Building gcc from source: The bottle needs the Xcode CLT to be installed. xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Error: An exception occurred within a child process: CompilerSelectionError: gcc cannot be built with any available compilers. Install GNU's GCC brew install gcc
解决办法:安装或更新到最新版本的Xcode
重新安装Xcode后,重新安装gcc,显示:
Warning: Building gcc from source: The bottle needs the Xcode CLT to be installed. xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Error: An exception occurred within a child process: CompilerSelectionError: gcc cannot be built with any available compilers. Install GNU's GCC brew install gcc
解决办法:需要安装Xcode CLT
参考地址
- Mac下的dlib安装:https://blog.csdn.net/Quincuntial/article/details/53572415 作者:SnailTyan