MAC安装dlib

安装dlib

官方文档,可查看How to install dlib from source on macOS or Ubuntu

dlib的依赖

  • dlib安装需要的依赖有openblas,opencv。可以直接使用brew安装。
$ brew install openblas
$ brew install opencv

安装出现:gcc安装失败(具体显示如问题),安装gcc

  • Mac的X11
    X11是执行Unix程序的图形窗口环境。Mac OS X本身的程序是Aqua界面的,但是为了能够兼容unix和linux移植过来的程序(Mac OS X由BSD-UNIX修改而来),比如MatLab,就需要x11窗口环境。

运行dlib需要X11,但Mac目前没有自带X11,需要重新下载安装,下载地址,下载后直接安装,默认安装目录为/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安装 作者:SnailTyan

你可能感兴趣的:(Other)