在Python27中运行pip install dlib装载库dlib所引起的问题解决
来源:互联网 发布:关于贼的网络用语 编辑:程序博客网 时间:2024/05/14 11:36
看人脸方面的资料的时候,会发现很多人都会提到dlib这个库,于是就安装尝试下这个库看看它到底有多么的神奇。今天只是初次尝试一下dlib到底怎么用。
可是在安装这个库的时候遇到一堆问题:最初是没有Cmake编译器,这个好解决,cmake都是自动安装配置的。最大的问题如下所出现的,没有发现boost库:
-- Could NOT find Boost
于是乎,编译Boost库成了首要问题。
D:\Program Files\Python\Python27>pip install dlib
Collecting dlib
Using cached dlib-19.1.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command "d:\program files\python\python27\python.exe" -
u -c "import setuptools, tokenize;__file__='d:\\downlo~1\\system~1\\pip-build-a2
eyii\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().
replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install -
-record d:\downlo~1\system~1\pip-teyh4o-record\install-record.txt --single-versi
on-externally-managed --compile:
running install
running build
Detected Python architecture: 32bit
Detected platform: win32
Configuring cmake ...
-- Building for: Visual Studio 10 2010
-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Stu
dio 10.0/VC/bin/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Stu
dio 10.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual S
tudio 10.0/VC/bin/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual S
tudio 10.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at D:/Program Files/CMake/share/cmake-3.7/Modules/FindBoost.cm
ake:744 (message):
Imported targets not available for Boost version 106300
Call Stack (most recent call first):
D:/Program Files/CMake/share/cmake-3.7/Modules/FindBoost.cmake:848 (_Boost
_COMPONENT_DEPENDENCIES)
D:/Program Files/CMake/share/cmake-3.7/Modules/FindBoost.cmake:1435 (_Boos
t_MISSING_DEPENDENCIES)
D:/Downloads/SystemTemp/pip-build-a2eyii/dlib/dlib/cmake_utils/add_python_
module:73 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
-- Found PythonLibs: D:/Program Files/Python/Python27/libs/python27.lib (fou
nd suitable version "2.7.12", minimum required is "2.6")
-- ************************************************************************
*****************************
-- We couldn't find the right version of boost python. If you installed boo
st and you are still getting this error then you might have installed a version
of boost that was compiled with a different version of visual studio than the on
e you are using. So you have to make sure that the version of visual studio is
the same version that was used to compile the copy of boost you are using.
-- Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before run
ning cmake.
-- E.g. Something like this:
-- set BOOST_ROOT=C:\local\boost_1_57_0
-- set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib
--
-- You will also likely need to compile boost yourself rather than using on
e of the precompiled
-- windows binaries. Do this by going to the folder tools\build\ within bo
ost and running
-- bootstrap.bat. Then run the command:
-- b2 install
-- And then add the output bin folder to your PATH. Usually this is the C:
\boost-build-engine\bin
-- folder. Finally, go to the boost root and run a command like this:
-- b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
-- When it completes, set BOOST_LIBRARYDIR equal to wherever b2 put the com
piled libraries.
-- Note that you will need to set the address-model based on if you want a
32 or 64bit python library.
--
-- Next, when you invoke cmake to compile dlib you may have to use cmake's
-G option to set the
-- 64 vs. 32bit mode of visual studio. Also, if you want a Python3 library
you will need to
-- add -DPYTHON3=1. You do this with a statement like:
-- cmake -G "Visual Studio 12 2013 Win64" -DPYTHON3=1 ..\..\tools\python
-- Rather than:
-- cmake ..\..\tools\python
-- Which will build a 32bit Python2 module by default on most systems.
--
-- ************************************************************************
*****************************
CMake Error at D:/Downloads/SystemTemp/pip-build-a2eyii/dlib/dlib/cmake_util
s/add_python_module:115 (message):
Boost python library not found.
Call Stack (most recent call first):
CMakeLists.txt:6 (include)
-- Configuring incomplete, errors occurred!
See also "D:/Downloads/SystemTemp/pip-build-a2eyii/dlib/tools/python/build/C
MakeFiles/CMakeOutput.log".
error: cmake configuration failed!
----------------------------------------
Command ""d:\program files\python\python27\python.exe" -u -c "import setuptools,
tokenize;__file__='d:\\downlo~1\\system~1\\pip-build-a2eyii\\dlib\\setup.py';f=
getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.
close();exec(compile(code, __file__, 'exec'))" install --record d:\downlo~1\syst
em~1\pip-teyh4o-record\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in d:\downlo~1\system~1\pip-build-a2eyii\dlib\
D:\Program Files\Python\Python27>
首先下载boost库,根据提示:
1)运行 bootstrap.bat. 生成三个文件,其中包括b2
-- bootstrap.bat
2)运行b2
-- b2 install
3) 利用b2编译库文件
-- b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
这里遇到些问题, address-model=64参数设置出现问题,后改成32则成功。
4)设置变量
-- set BOOST_ROOT=C:\local\boost_1_57_0
-- set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib
将这两个变量设置到到Path变量中: %BOOST_ROOT%;%BOOST_LIBRARYDIR%
5)然后运行pip install dlib
成功
D:\Program Files\Python\Python27>pip install dlib
Collecting dlib
Using cached dlib-19.1.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... done
Successfully installed dlib-19.1.0
D:\Program Files\Python\Python27>
可是在安装这个库的时候遇到一堆问题:最初是没有Cmake编译器,这个好解决,cmake都是自动安装配置的。最大的问题如下所出现的,没有发现boost库:
-- Could NOT find Boost
于是乎,编译Boost库成了首要问题。
D:\Program Files\Python\Python27>pip install dlib
Collecting dlib
Using cached dlib-19.1.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command "d:\program files\python\python27\python.exe" -
u -c "import setuptools, tokenize;__file__='d:\\downlo~1\\system~1\\pip-build-a2
eyii\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().
replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install -
-record d:\downlo~1\system~1\pip-teyh4o-record\install-record.txt --single-versi
on-externally-managed --compile:
running install
running build
Detected Python architecture: 32bit
Detected platform: win32
Configuring cmake ...
-- Building for: Visual Studio 10 2010
-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Stu
dio 10.0/VC/bin/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Stu
dio 10.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual S
tudio 10.0/VC/bin/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual S
tudio 10.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at D:/Program Files/CMake/share/cmake-3.7/Modules/FindBoost.cm
ake:744 (message):
Imported targets not available for Boost version 106300
Call Stack (most recent call first):
D:/Program Files/CMake/share/cmake-3.7/Modules/FindBoost.cmake:848 (_Boost
_COMPONENT_DEPENDENCIES)
D:/Program Files/CMake/share/cmake-3.7/Modules/FindBoost.cmake:1435 (_Boos
t_MISSING_DEPENDENCIES)
D:/Downloads/SystemTemp/pip-build-a2eyii/dlib/dlib/cmake_utils/add_python_
module:73 (FIND_PACKAGE)
CMakeLists.txt:6 (include)
-- Could NOT find Boost
-- Found PythonLibs: D:/Program Files/Python/Python27/libs/python27.lib (fou
nd suitable version "2.7.12", minimum required is "2.6")
-- ************************************************************************
*****************************
-- We couldn't find the right version of boost python. If you installed boo
st and you are still getting this error then you might have installed a version
of boost that was compiled with a different version of visual studio than the on
e you are using. So you have to make sure that the version of visual studio is
the same version that was used to compile the copy of boost you are using.
-- Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before run
ning cmake.
-- E.g. Something like this:
-- set BOOST_ROOT=C:\local\boost_1_57_0
-- set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib
--
-- You will also likely need to compile boost yourself rather than using on
e of the precompiled
-- windows binaries. Do this by going to the folder tools\build\ within bo
ost and running
-- bootstrap.bat. Then run the command:
-- b2 install
-- And then add the output bin folder to your PATH. Usually this is the C:
\boost-build-engine\bin
-- folder. Finally, go to the boost root and run a command like this:
-- b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
-- When it completes, set BOOST_LIBRARYDIR equal to wherever b2 put the com
piled libraries.
-- Note that you will need to set the address-model based on if you want a
32 or 64bit python library.
--
-- Next, when you invoke cmake to compile dlib you may have to use cmake's
-G option to set the
-- 64 vs. 32bit mode of visual studio. Also, if you want a Python3 library
you will need to
-- add -DPYTHON3=1. You do this with a statement like:
-- cmake -G "Visual Studio 12 2013 Win64" -DPYTHON3=1 ..\..\tools\python
-- Rather than:
-- cmake ..\..\tools\python
-- Which will build a 32bit Python2 module by default on most systems.
--
-- ************************************************************************
*****************************
CMake Error at D:/Downloads/SystemTemp/pip-build-a2eyii/dlib/dlib/cmake_util
s/add_python_module:115 (message):
Boost python library not found.
Call Stack (most recent call first):
CMakeLists.txt:6 (include)
-- Configuring incomplete, errors occurred!
See also "D:/Downloads/SystemTemp/pip-build-a2eyii/dlib/tools/python/build/C
MakeFiles/CMakeOutput.log".
error: cmake configuration failed!
----------------------------------------
Command ""d:\program files\python\python27\python.exe" -u -c "import setuptools,
tokenize;__file__='d:\\downlo~1\\system~1\\pip-build-a2eyii\\dlib\\setup.py';f=
getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.
close();exec(compile(code, __file__, 'exec'))" install --record d:\downlo~1\syst
em~1\pip-teyh4o-record\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in d:\downlo~1\system~1\pip-build-a2eyii\dlib\
D:\Program Files\Python\Python27>
首先下载boost库,根据提示:
1)运行 bootstrap.bat. 生成三个文件,其中包括b2
-- bootstrap.bat
2)运行b2
-- b2 install
3) 利用b2编译库文件
-- b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
这里遇到些问题, address-model=64参数设置出现问题,后改成32则成功。
4)设置变量
-- set BOOST_ROOT=C:\local\boost_1_57_0
-- set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib
将这两个变量设置到到Path变量中: %BOOST_ROOT%;%BOOST_LIBRARYDIR%
5)然后运行pip install dlib
成功
D:\Program Files\Python\Python27>pip install dlib
Collecting dlib
Using cached dlib-19.1.0.tar.gz
Installing collected packages: dlib
Running setup.py install for dlib ... done
Successfully installed dlib-19.1.0
D:\Program Files\Python\Python27>
0 1
- 在Python27中运行pip install dlib装载库dlib所引起的问题解决
- dlib 18 android编译dlib库,运行matrix_ex demo
- 【Dlib】在项目中同时导入Dlib库和OpenCV库
- 【%Dlib%】Dlib在VS2013上的配置方法
- Dlib库的安装配置
- 机器学习库Dlib在VS2015上的安装教程
- Dlib库中实现正脸人脸检测的测试代码
- dlib在window的安装方法
- Dlib在VS2013上的配置方法
- Dlib 学习过程中遇到的坑
- dlib库中svm 例程解析
- Dlib中Delaunay Triangulation
- 图像处理库dlib的配置
- dlib库svm_c_ex.cpp的详细注解
- linux下dlib库的安装
- dlib的编译
- 五、dlib的安装
- Dlib的编译
- 12.30js学习笔记
- 解决用Mysql 使用navicate远程连接数据库出现1045 access denied for user 'root'@'localhost' using password yes
- 页面跳转方法
- oracle表分区详解(按天、按月、按年等)
- 带你玩转Java之二十九Oracle-简单sql语句的操作(全汇总)
- 在Python27中运行pip install dlib装载库dlib所引起的问题解决
- 一种动态call地址查找及使用方法 -- QQ游戏斗地主角色版-喊话call定位技巧
- 产品与营运之冷启动
- 配置CentOS6的yum源
- 简单的文件系统模拟C/C++(操作系统)
- opencv 识别印刷体数字
- Kali Linux 2.0安装VMware-tools
- Android网络打印机的那些事
- 什么是面向对象的JavaScript(四)——多态