Python learning diary-install dlib in Linux (mainly install cmake and boost) and dlibcmake

Source: Internet
Author: User

Python learning diary-install dlib in Linux (mainly install cmake and boost) and dlibcmake

Yesterday we used dlib and opencv for Face Detection tagging (http://www.cnblogs.com/take-fetter/p/8310298.html)

However, the running environment is windows-based and may not cause any problems during installation and running because the visual studio configuration on my computer is complete.

Because I plan to run the program on Raspberry Pi later, I plan to move the program I made yesterday to linux for a try. I have encountered many difficulties to sum up, opencv installation has not encountered any problems

Environment: deep linux 15.5, anaconda3, pycharm 2017.3

To install dlib, you must first install cmake and boost.

  • Cmake Installation

Https://cmake.org/download/

Download the installation package, decompress the package to the directory, and run the package in sequence.

./bootstrapmakemake install
  • Boost Installation

Http://www.boost.org/download the installation package

Decompress the package to the directory and enter

sudo apt install python3-dev build-essential./bootstrap.sh --with-libraries=all --with-toolset=gcc --with-python=python3.6

Because the default value is Python2, if the following problem occurs before the program is run after the installation is complete, it turns out to be an error.
But this with python parameter will have a problem, after compilation won't compile the required file https://www.jianshu.com/p/b9da6256aafe in this article -- with-python is = python3.5 don't know if it can work,I am not successful in 3.6.

I flipped through the document in the package and did not see the specific usage method. My solution is at the end of the article.

Traceback (most recent call last):File "/media/takefetter/demo/dlib/facial-landmarks/my_facial_landmarks.py", line 5, in <module>import dlibFile "/home/takefetter/anaconda3/envs/tensorflow/lib/python3.6/site-packages/dlib/__init__.py", line 1, in <module>from .dlib import *ImportError: /usr/local/lib/libboost_python.so.1.66.0: undefined symbol: PyString_Type


Enter

./b2 toolset=gcc

The next step is to wait quietly. It takes about 10 minutes for compilation.

...failed updating 66 targets......skipped 12 targets......updated 1251 targets...

And return to the command line again to run

./b2 install --prefix=/usr

Install it in the/usr directory, where -- prefix =/usr is used to specify the boost installation directory, without this parameter, the default header file is in the/usr/local/include/boost directory, and the library file is in the/usr/local/lib/directory. If you specify the installation directory as -- prefix =/usr, boost will directly install it in the system header file directory and library file directory. You can omit the configuration environment variables.

Delete the boost library by the way: Delete the boost file in/usr/include and all the files about boost in/usr/lib.

Last use

ldconfig

Update the dynamic link library of the system

  • Dlib Installation and Use
pip install dlib

(Anaconda remember to use the source activate environment name to enter the specific python environment)

 

Solution:

Libboost_python.so.1.66.0: cannot open shared object file: No such file or directory

I have compiled this file several times and I cannot generate this file. I can only drop one file on the Internet :(

Https://files.cnblogs.com/files/take-fetter/libboost_python.so.1.66.0.zip downloaded and put in usr/lib

Simply running normally, watching the sea is still the view of the sea yesterday (by mistake ......

I don't know what will happen in the future, but I still want to change my mac)

Related Article

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.