centos构建face_recognition环境


0.face_recognition官方文档

https://github.com/ageitgey/face_recognition

1. 安装face_recognition

1.1 安装dlib

1) 安装开发环境

[root@localhost ~]# yum update
[root@localhost ~]#yum groupinstall "Development Tools"

2) 安装OpenCV

[root@localhost ~]# yum install cmake python-devel numpy gcc gcc-c++ gtk2-devel libdc1394-devel libv4l-devel ffmpeg-devel gstreamer-plugins-base-devel libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel libtiff-devel libwebp-devel opencv opencv-python opencv-devel

3) 升级gcc版本,确保安装过程正确

wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo

sudo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++

软件会被安装在/opt/rh目录下。
配置环境变量:

export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc
export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++

别忘了. /etc/profile。

将安装的目录软链接到local/bin。

ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r

*** 如果gcc已经为最新版本,忽略这一步骤。

[root@localhost ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)

4) 安装boost

[root@localhost ~]#yum install boost
[root@localhost ~]#yum install boost-devel
[root@localhost ~]#yum install boost-doc

或者

[root@localhost ~]#yum install boost boost-devel boost-doc

5) 安装dlib

[root@localhost ~]# pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... done
Successfully installed dlib-19.16.0

这一步安装非常耗时间(在我的机器上用了将近30多分钟)。

6) 安装libXdmcp

为了解决导入错误,还需要安装libXdmcp。

[root@localhost ~]# yum install libXdmcp libXdmcp-devel

1.2 安装face_recognition

[root@localhost ~]# pip installface_recognition

检查安装结果:

[root@localhost ~]# ipython
Python 2.7.5 (default, Jul 13 2018, 13:06:57)
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.


Caching the list of root modules, please wait!
(This will only be done once - type '%rehashx' to reset cache!)

This is taking too long, we give up.

In [1]: importface_recognition

In [2]:

优质内容筛选与推荐>>
1、阶段1 语言基础+高级_1-3-Java语言高级_1-常用API_1_第2节 匿名对象_6-匿名对象的说明
2、nose的使用
3、fork和exec系统调用在内核中的执行过程
4、秋招笔试题总结一
5、正则表达式 re模块


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号