Linux install the Python face Recognition face_recognition module

Source: Internet
Author: User
Tags bz2 sqlite

System Environment: CentOS6.7

Anaconda Version: anaconda3-5.1.0-linux-x86_64

Python version: Python-3.6.4

1. Yum installation CMake, boost

Yum Install CMake boost

2. Yum Install gcc gcc-c++

Yum Install gcc gcc-c++

Use Yum to install the existing version of the system, and then upgrade to 4.8.1 after uninstalling the Yum version

3. Install Dlib package with Conda

# Conda Install Dlib

[ROOT@HADOOP7 pkgs]# condainstall dlib solving environment:done ==> warning:a newer versionof Conda. <== version:4.4.10 latest version:4.5.1 Please update Conda by running $ conda update-n BA Se Conda # # Package Plan # Environment location:/root/anaconda3 added/updated Specs:-Dlib T            He following packages would bedownloaded:package |                Build---------------------------|-----------------ca-certificates-2018.1.18 | 0 140 KB conda-forge numpy-1.14.2 |py36_blas_openblas_200 9.0 MB Conda-forge opens                SL-1.0.2O |         0 3.5 MB Conda-forge blas-1.1 |                Openblas 1 KB conda-forge sqlite-3.20.1 |           0 1.3 MB Conda-forge certifi-2018.1.18 |    PY36_0 143 KB Conda-forge scipy-1.0.1            |py36_blas_openblas_200 39.8 MB Conda-forge scikit-learn-0.19.1 |py36_blas_openblas_201                12.8 MB Conda-forge libgfortran-3.0.0 |                1 281 KB Https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free openblas-0.2.20 | 7 17.0 MB Conda-forge dlib-19.10 |py36_blas_openblas_200 2.3 MB conda-forge----

 

--------------------------------------------------------total:86.3 MB                                           

    The following NEW packages Willbe Installed:blas:1.1-openblas Conda-forge                                            Dlib:19.10-py36_blas_openblas_200conda-forge [Blas_openblas] Libgfortran:3.0.0-1 https://mirrors.tuna.tsinghua.edu.cn/ Anaconda/pkgs/free openblas:0.2.20-7 CondA-forge the following packages would beremoved:anaconda:5.1 .0-py36_2 defaults The following packages would beupdated : Ca-certificates:2017.08.26-h1d4fec5_0 Defaults--> 2018                                               .1.18-0 Conda-forge Certifi:2018.1.18-py36_0 Defaults --> 2018.1.18-py36_0 conda-forge numpy:1.14.0-py36h3dfced4_1 de

    Faults-->1.14.2-py36_blas_openblas_200 Conda-forge [Blas_openblas]                     Openssl:1.0.2n-hb7f436b_0 Defaults--> 1.0.2o-0                                               Conda-forge scikit-learn:0.19.1-py36h7aa7ec6_0 Defaults --> 0.19.1-py36_blas_openblas_201 Conda-forge [Blas_openblas] scipy:1.0.0-py36hbf646e7_0 defaults --> 1.0.1-py36_blas_openblas_200 Conda-forge [Blas_openblas] the following PAC                                               Kages would bedowngraded:sqlite:3.22.0-h1bed415_0 defaults --> 3.20.1-0 conda-forge Proceed ([y]/n)? Y


You can see that you need to download a lot of other dependencies, and you will automatically download the installation when you enter Y. If download fails, you can manually download the installation file installation

Such as:

CD/PATH/ANACONDA3/PKGS (package default installation path)

wgethttps://ffmpeg.org/releases/ffmpeg-3.4.2.tar.bz2

Conda Install ffmpeg-3.4.2.tar.bz2

4. PIP installation for Face_recgnition

# pip Install Face_recgnition

Possible error: "/usr/lib64/libstdc++.so.6:version ' glibcxx_3.4.19 ' not Found"

Face_recognition module installation, if the error "unsupportedcompiler--PYBIND11 requires c++11 support!", stating that the GCC version is not high enough to upgrade GCC, method:

Download GCC Latest Version

Wgethttp://ftp.gnu.org/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.gz

Then unzip to the folder

Tar-xvzf gcc-4.8.1.tar.gz

The directory after the decompression

CD gcc-4.8.1

Then perform the following run

./contrib/download_prerequisites

Go back to the previous layer and set up the build_gcc_4.8.1 directory, which is parallel to the gcc-4.8.1

Cd..

mkdir build_gcc_4.8.1

Enter the newly created directory and execute the compilation process

CD build_gcc_4.8.1

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

Make-j23

Make install

OK, GCC is already installed in build_gcc_4.8.1

To determine the path of the newly installed GCC, the path to the last MV when you installed it, I am the default/usr/local/bin

Ls/usr/local/bin | grep gcc

Perform:

/usr/sbin/update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.1 40

GCC--version #查看版本

/usr/sbin/update-alternatives--install/usr/bin/g++ g++/usr/local/bin/g++ 40

g++--version #查看版本

After the installation of the high version gcc is complete, use the "Yum Remove gcc-c++" and "yum remove gcc" To uninstall the lower version of the GCC compiler

Re-install face_recgnition will succeed

# pip Install Face_recgnition

5. Test Import Package

[ROOT@HADOOP8 pkgs]# python

Python 3.6.4 | Anaconda, inc.| (Default, Jan16 2018, 18:10:19)

[GCC 7.2.0] on Linux

Type ' help ', ' copyright ', ' credits ' or ' license ' for moreinformation.

>>> Import Dlib

>>> Import Face_recognition

>>>exit ()

6. Other installation problems

Possible unexpected conditions for manual Dlib installation:

Error 1:build, the error "The CXX compiler identification is unknown". This situation requires the installation of GCC (as a cxxcompiler), and the issues to be noted are the context.

Error 2:build, the error "could not find Pythonlibs (missing:python_include_dirs)", in this case, the CMake command to specify:

-dpython_include_dir=/usr/python/include/python3.6m (this path should be the installation path that exists for the Python.h file, depending on the machine path)

-dpython_library=/usr/python/lib/libpython3.so (this path should be the installation path that exists for the libpython.**.so file, depending on the machine path)

The complete command is as follows: Enter cmake-dpython_include_dir=/usr/python/include/python3.6m-dpython_library=/usr/under Build path in Dlib source code Python/lib/libpython3.so.. /.. /tools/python/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.