使用 Windows 10 在 Python 3.5 上安装 dlib 时出错

Error when installing dlib on Python 3.5 using Windows 10

编辑:看来我必须安装 Visual Studio 2015...我可以在没有 VS 2015 的情况下安装 dlib 吗?我已经预装了 Windows.

的旧版本

我正在使用 Python 3.5,试图在终端的 PyCharm 上安装 dlib,这就是我得到的结果,我对这些错误的每一次搜索...我都找到了东西在 Visual Studio 上,我没有 GUI + 我在任何 Visual Studio 版本(8、11、12、 14). 在网上发布这个问题之前,我进行了大量搜索。 我需要下载 Visual Studio 最新版本才能获得 vcvarsall.bat 吗?

这是CMakeLists.txt:

cmake_minimum_required(VERSION ${CMAKE_VERSION})
project(IntelFortranImplicit Fortran)
add_custom_command(
  OUTPUT output.cmake
  COMMAND ${CMAKE_COMMAND} -P ${IntelFortranImplicit_SOURCE_DIR}/detect.cmake
  )
add_library(FortranLib hello.f output.cmake)

这是我执行时的错误:pip install dlib

  Collecting dlib
      Using cached dlib-19.6.1.tar.gz
    Building wheels for collected packages: dlib
      Running setup.py bdist_wheel for dlib ... error
      Complete output from command C:\Users\tiger\Anaconda3\envs\TensorFlowExample\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\tiger\AppDat
    a\Local\Temp\pip-build-gjtgkl6a\dlib\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code
    , __file__, 'exec'))" bdist_wheel -d C:\Users\tiger\AppData\Local\Temp\tmprc21rnv_pip-wheel- --python-tag cp35:
      running bdist_wheel
      running build
      error: Cannot find cmake, ensure it is installed and in the path.
      You can install cmake using the instructions at https://cmake.org/install/
      You can also specify its path with --cmake parameter.

      ----------------------------------------
      Failed building wheel for dlib
      Running setup.py clean for dlib
    Failed to build dlib
    Installing collected packages: dlib
      Running setup.py install for dlib ... error
        Complete output from command C:\Users\tiger\Anaconda3\envs\TensorFlowExample\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\tiger\AppD
    ata\Local\Temp\pip-build-gjtgkl6a\dlib\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(co
    de, __file__, 'exec'))" install --record C:\Users\tiger\AppData\Local\Temp\pip-dk1naa28-record\install-record.txt --single-version-externally-managed --compile
    :
        running install
        running build
        error: Cannot find cmake, ensure it is installed and in the path.
        You can install cmake using the instructions at https://cmake.org/install/
        You can also specify its path with --cmake parameter.

        ----------------------------------------
    Command "C:\Users\tiger\Anaconda3\envs\TensorFlowExample\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\tiger\AppData\Local\Temp\pip-bu
    ild-gjtgkl6a\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 C:\Users\tiger\AppData\Local\Temp\pip-dk1naa28-record\install-record.txt --single-version-externally-managed --compile" failed with error code
     1 in C:\Users\tiger\AppData\Local\Temp\pip-build-gjtgkl6a\dlib\

在此处找到解决方案: Using Anaconda installing manager..! 运行 PyCharm 终端中的以下内容:conda install -c conda-forge dlib=19.4 我能够使用 dlib! :)

非常感谢 birryree 在评论中让我知道!

  1. 在管理模式下打开 Anaconda Prompt。
  2. conda更新conda 3.conda更新anaconda
  3. conda create -n dlib_env python=3.7
  4. conda 激活 dlib_env
  5. conda 安装-c conda-forge dlib
  6. python 7.1 >>> 导入 dlib 7.2 >>> dlib.版本

Source