东方耀AI技术分享

标题: 11、成功安装C++开源库dlib(人脸业务相关) [打印本页]

作者: 东方耀    时间: 2020-2-27 18:14
标题: 11、成功安装C++开源库dlib(人脸业务相关)
成功安装C++开源库dlib(人脸业务相关)






pip install dlib 后各种报错




CMake must be installed to build the following extensions: dlib
安装cmake:http://www.ai111.vip/thread-977-1-1.html


又报错:找不到gcc g++


-- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    -- Check for working C compiler: /usr/lib/gcc
    -- Check for working C compiler: /usr/lib/gcc -- broken


-- The C compiler identification is unknown
  -- The CXX compiler identification is unknown
  -- Check for working C compiler: /usr/lib/gcc/x86_64-linux-gnu/7
  -- Check for working C compiler: /usr/lib/gcc/x86_64-linux-gnu/7 -- broken






安装dlib的时候可能会出问题,因为dlib需要编译,出现的问题一般是gcc或者g++版本的问题,可以通过在命令行键入




dfy888@Dfy888-Ubuntu:~$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


dfy888@Dfy888-Ubuntu:~$ g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


gcc -v  信息更多
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper




命令找一下:whereis xxx
dfy888@Dfy888-Ubuntu:~$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/man/man1/gcc.1.gz
dfy888@Dfy888-Ubuntu:~$ whereis g++
g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz


关键在这:终端执行
export CC=/usr/bin/gcc
export CXX=/usr/bin/g++


来指定你gcc和g++对应的位置,(这两句话会临时修改当前终端的环境变量/usr/bin/gcc对应你自己gcc或者g++所在目录)




之后成功啦!



作者: 东方耀    时间: 2020-3-14 09:21
如果安装低版本的dlib:pip3 install dlib==19.8.1   则没有报错  亲测:win10中
如果 pip3 install dlib 则会安装最新版 会报错 需要cmake
作者: 东方耀    时间: 2020-3-14 09:25
东方耀 发表于 2020-3-14 09:21
如果安装低版本的dlib:pip3 install dlib==19.8.1   则没有报错  亲测:win10中
如果 pip3 install dlib  ...

这样好像就没办法用GPU了  只能CPU
作者: 东方耀    时间: 2020-6-23 17:18
推荐用这个方法:Ubuntu技巧:Ubuntu下多个gcc版本设置优先级
http://www.ai111.vip/thread-1052-1-1.html
作者: 东方耀    时间: 2020-6-23 17:23
pip3 uninstall dlib

不要使用缓存 需要重新编译dlib 因为gcc  g++版本降低了
pip3 --no-cache-dir install dlib

作者: 东方耀    时间: 2020-6-28 11:14
win10 64位系统  直接去下载已经编译好的whl轮子    :https://pypi.org/simple/dlib/   

pip3 install dlib-19.8.1-cp36-cp36m-win_amd64.whl   

  1. (py3_jingyun) E:\softwares>pip3 install dlib-19.8.1-cp36-cp36m-win_amd64.whl
  2. Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
  3. Processing e:\softwares\dlib-19.8.1-cp36-cp36m-win_amd64.whl
  4. Installing collected packages: dlib
  5. Successfully installed dlib-19.8.1
复制代码







欢迎光临 东方耀AI技术分享 (http://www.ai111.vip/) Powered by Discuz! X3.4