使用 Visual Studio 2015 库安装 dlib

Posted

技术标签:

【中文标题】使用 Visual Studio 2015 库安装 dlib【英文标题】:install dlib using Visual Studio 2015 libraries 【发布时间】:2018-10-14 05:58:38 【问题描述】:

我已经下载了 dlib,当我尝试使用 python setup install 安装它时,它给了我这个错误,我正在使用 Visual Studio 2015 专业版

running install
running bdist_egg
running egg_info
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
writing dlib.egg-info\PKG-INFO
package init file 'dlib\__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Invoking CMake setup: 'cmake C:\Users\Mouhsine\Desktop\DeepLearning and SVM\dlib-master\tools\python
 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Mouhsine\Desktop\DeepLearning and SVM\dlib-master\build\l
ib.win-amd64-3.5 -DPYTHON_EXECUTABLE=D:\Python35\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE
=C:\Users\Mouhsine\Desktop\DeepLearning and SVM\dlib-master\build\lib.win-amd64-3.5 -A x64'
-- pybind11 v2.2.2
-- Using CMake version: 3.11.0-rc4
-- NOTE: Visual Studio didn't have good enough C++11 support until Visual Studio 2015 update 3 (v19.
0.24210.0)
-- So we aren't enabling things that require full C++11 support (e.g. the deep learning tools).
-- Also, be aware that Visual Studio's version naming is confusing, in particular, there are multipl
e versions of 'update 3'
-- So if you are getting this message you need to update to the newer version of Visual Studio to us
e full C++11.
-- Enabling SSE4 instructions
-- C++11 activated.
CMake Error at CMakeLists.txt:31 (message):
  You have to use a version of Visual Studio that supports C++11.  As of
  December 2017, the only versions that have good enough C++11 support to
  compile the dlib Pyhton API is a fully updated Visual Studio 2015 or a
  fully updated Visual Studio 2017.  Older versions of either of these
  compilers have bad C++11 support and will fail to compile the Python
  extension.  ***SO UPDATE YOUR VISUAL STUDIO TO MAKE THIS ERROR GO AWAY***

我的情况应该怎么办

【问题讨论】:

您是否阅读了错误信息?它非常详细地告诉你要做什么。 你做了什么来解决它? 我尝试在我正在使用的 VS 中启用 c++11,但它对我不起作用 如报错,您需要获取新版本的Visual Studio,因为您的版本不完全支持C++11。您有两个选择:2015 年全面更新或 2017 年全面更新。 【参考方案1】:

就我而言,我已将 Visual Studio 2015 更新为 update3,我发现版本是 14.0.25431,而不是 v19.0.24210.0。所以我改变了

\dlib\cmake_utils\set_compiler_specific_options.cmake file

,并编辑

elseif(MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.24210.0 ) 

elseif(MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0.24210.0 )

然后一切正常。

【讨论】:

以上是关于使用 Visual Studio 2015 库安装 dlib的主要内容,如果未能解决你的问题,请参考以下文章

Visual Studio 2015 编译生成支持HTTPS协议的libcurl静态库

Visual Studio2015 Nuget安装OpencvSharp包

提升Visual Studio 2015上的库

Ubuntu 15.04系统怎么安装Visual Studio Code 2015

Windows Visual Studio 2015、C++11 标准和 Armadillo 库

win10安装visual studio 2015 出现安装包丢失或损坏是啥原因