在python 3.7.3 64位Windows 10上安装dlib时如何修复错误

时间:2019-08-21 09:05:50

标签: python cmake dlib

我正在尝试使用anaconda提示符在Windows 10上安装dlib。使用pip install dlib 但是我遇到了这个错误

Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
    CMake Error in CMakeLists.txt:
      Generator

        NMake Makefiles

      does not support platform specification, but platform

        x64

      was specified.


    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!

我已经使用pip install cmake安装了cmake,并且已成功下载。

1 个答案:

答案 0 :(得分:0)

默认情况下,您的cmake使用的发电机似乎与平台所支持的发电机不同。在您的cmd中,键入cmake --help。这将打印出发电机列表,供我选择,

The following generators are available on this platform:
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".

确保您也有Visual Studio 15 ...行。然后,您应该能够运行安装:

  1. 获取源代码,例如v19.17
  2. 解压缩,然后在解压缩的源文件夹中打开cmd
  3. 运行python setup.py -G Visual Studio 15 2017 Win64

这应该告诉cmake使用正确的Visual Studio生成器。

值得一提的是,由于您似乎正在使用anaconda,因此dlib应该可以从conda-forge获得,并且可以像thie一样安装:

conda install -c conda-forge dlib