Installation of face_recognition and dlib (ubuntu16.04+python3.6)

Install dlib and face_recognition (ubuntu) in a virtual environment
(refer to https://blog.csdn.net/gf_lvah/article/details/79482585
      http://www.cnblogs.com/whenyd/p/7721989.html)


The details of installation in different environments may be different, here is only for the following environments:
operating system: ubuntu16.04
python version: python3.6
dlib version: 19.17
face_recogition version: 1.2.3

ps: Because I have been in contact with the ubuntu system for a short time, the installation of various software was a bit messy at the beginning, so my virtual environment py36 has both python2.7 and python3.6, but version 3.6 is the default version used. So this time I installed face_recognition in my virtual environment py36 with twists and turns, and according to someone on the Internet, python3.6 corresponds to dlib19.7, and then I learned that the latest version 19.17 is also applicable to python3.6 on the official website of dlib. So if your python version is different, it is best to check the corresponding version of dlib first.


(1) Source code installation dlib:
① Source code download, the dlib package can be downloaded directly on pypi (https://pypi.org/project/dlib/19.7.0/#files), select dlib-19.7.0.tar.gz Download and unzip
 ps: When downloading, I tried to clone from the github library (git clone https://github.com/davisking/dlib.git), but finally found that dlib was installed in python2, but in fact I was executing step ③ When stepping, I use python instead of python2. I still don’t know what caused this reason (you are welcome to leave a message for guidance). After downloading from pypi, there will be no problems in the follow-up.
② Activate the virtual environment py36 (source activate py36)
③ After cd to the dlib decompressed folder, you can see setup.py, execute
    python setup.py install --no DLIB_USE_CUDA
 ps: Many people directly execute python setup when executing this step .py install, but I always make mistakes when executing, and according to the analysis of the error content, it is related to CUDA, so here you can specify not to use CUDA, which may be related to my environment. ④Verify whether it is installed in the virtual environment
py36
 :
  python (display python version and other information)
  import dlib (no prompt indicates successful installation)
  dlib.__version__ (display dlib version)

(2) Install face_recognition
    pip install face_recognition

  ps: In the settings-->Project Interpreter in pycharm, select the environment as py36, click the "+" on the right, you can search for the package dlib you want to install, and at the same time check the Specity version in the lower right corner, and select the 19.17 version , click "Install Package" in the lower left corner to successfully install dlib. However, it may be because there are no related options, such as DLIB_USE_CUDA, that there will always be errors when installing face_recogniton later, and it is related to dlib.
  In addition, the face_recognition and dlib versions should also pay attention to the correspondence. I installed dlib 19.7 because some netizens said that python3.6 only corresponds to dlib 19.7, but I don’t know the specific version of face_recognition, so the latest version is installed by default. 1.2.3, although the installation seems to be successful, but when importing face_recogniton, the error "did not match C++ signature:__init__" is reported. After thinking about it, I think it should be the relationship between the versions. I uninstalled 19.7 of dlib, and went to the official website of dlib to check whether the latest 19.17 is suitable for my python3.6. The answer is yes. So I installed 19.17 of dlib, and the latest face_recogniton (1.2.3) version, and then I'm really done!

Guess you like

Origin blog.csdn.net/ali1174/article/details/89081367