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

标签 python cmake dlib

我正在尝试使用 anaconda 提示符在 Windows 10 上安装 dlib。使用 pip 安装 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 并且已成功下载。

最佳答案

默认情况下,您的 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 

关于python - 如何修复在 python 3.7.3 64 位 Windows 10 上安装 dlib 时出现的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57588118/

相关文章:

python - 代码适用于 x70 列的数据框,而 1000 列的数据框则失败(相同的数据结构)

linux - cmake 找不到环境变量

c++ - 如何使用 CMake 在 android 构建上编译和共享两个 c++ 库

python-3.x - 在Windows中使用pip命令安装dlib时出错

python - Pandas periodIndex bool 切片返回整个索引

python 集 : why is my_set = {*my_list} invalid?

python - 比较两个 anaconda 安装之间的包

linux - 在 Linux 中为多个 Python 版本安装 OpenCV

具有共享 Dlib 库的 C++ 程序在 Ubuntu 14.04 上速度极慢

c++ - 在 dlib 窗口中打印文本