centos7安装face_recognition踩各种坑

要在阿里云服务器上部署face_recognition。用的是centos7.  千辛万苦啊。感谢网上的各种解答。回报社会,我也把各种坑写下了。整理的有点乱。不过仔细看,有干货的。

 

感谢这个博主Fate小王子,他的博客 受益匪浅!

https://blog.51cto.com/10931223/2309722

 

第一步先升级python ,还要装OpenCV,中间出了一个错误,还要先安装 get-pip.py 。忘了啥原因了。还要升级pip。等等。不堪回首。大家自己查找吧。 

 

第一步  务必要修改yum镜像。 要不各种连接不上。

 

1.修改CentOS默认yum源为国内镜像

1、首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

 

2、进入yum源配置文件所在的文件夹

[root@localhost ~]# cd /etc/yum.repos.d/

 

3、查看CentOS系统版本

[root@localhost ~]# lsb_release -a

 

修改为阿里yum-mirrors.aliyun.com

3、下载ailiyunyum源配置文件到/etc/yum.repos.d/
CentOS7

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 

 

 

 2.升级gcc

 

 

升级gcc

下载 gcc

wget http://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz

tar -xvf gcc-8.3.0.tar.bz2

cd gcc-8.3.0

./contrib/download_prerequisits

mkdir build

cd build

../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

make -j4  #执行命令进行编译,此处利用4job,需编译时约40分钟,此值不宜设置过高(建议不要使用make -j来编译,虽然可以缩短编译时间,但极大可能会编译失败)

make install

其中执行./contrib/download_prerequisits将自动下载以下几个文件,这个几个文件在gcc编译时需要:

  • mpfr-2.4.2.tar.bz2
  • gmp-4.3.2.tar.bz2
  • mpc-0.8.1.tar.gz
  • isl-0.15.tar.bz2

由于网络条件不是很好,在下载这几个文件时很久都下载不下来,所以我中断了很多次,并删除下载了的文件,重新执行./contrib/download_prerequisits命令,下载完成后在configure时配置一些选项,我没有使用--prefix,在make install时将自动安装到/usr/local/gcc-5.4.0下,编译过程十分漫长

 

 

 

 

伴随着yum的更新 

 

gcc出错

https://blog.csdn.net/zhou920786312/article/details/80051318

cd  /etc/yum.repos.d

 

修改devtools-2.repo后缀名

 

mv devtools-2.repo devtools-2.Beirepo

 

yum clean all

 

yum update

 

yum makecache

 

 

 

 

安装boost

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

 

 

cmake /tmp/pip-install-d61u4971/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-d61u4971/dlib/build/lib.linux-x86_64-3.6 -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DCMAKE_BUILD_TYPE=Release

 

安装 dlib

wget https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz

 

cd dlib-19.16.0

python3.6 setup.py install

 

如果 出现 :致命错误:Python.h:没有那个文件

https://blog.csdn.net/wzhwei1987/article/details/84644418

原因是没有安装python dev

查看python dev包。由于我的python3使用yum安装的包为python36u

查看对应的开发包:【查询后根据自己安装的python版本来选择】

yum search python3 | grep dev

sudo yum install python36u-devel

 

安装face_recognition

[root@localhost ~]# pip install face_recognition

 

 

 

 

下载cmake

wget https://cmake.org/files/v3.14/cmake-3.14.0-rc1-Darwin-x86_64.tar.gz

 

修改/etc/profile配置文件

# vi /etc/profile

 

删除文件夹

rm -rf cmake-3.14.0-rc4

 

 

 

 

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 

 

./gcc-8.3.0/configure --prefix=/root/gcc-8.3.0 --enable-threads=posix --disable-checking --enable--long-long --host=i386-redhat-linux--with-system-zlib --enable-languages=c,c++,java

猜你喜欢

转载自www.cnblogs.com/duoba/p/10508182.html