python - CMake在Python Virtualenv中安装DLib时找不到C和C++编译器

标签 python c++ cmake compiler-errors

看完有关使用Python进行面部识别的教程之后,我设法在Linux笔记本电脑上编写了工作程序。今天,我试图在Windows 10 PC上做同样的事情,但是当尝试使用以下代码从源代码安装DLib时,我总是遇到错误:

python setup.py install

我收到的错误消息是这样的:
running install
running bdist_egg
running egg_info
writing dlib.egg-info\PKG-INFO
writing dependency_links to dlib.egg-info\dependency_links.txt
writing top-level names to dlib.egg-info\top_level.txt
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'
no previously-included directories found matching 'tools\python\build*'
no previously-included directories found matching 'dlib\test'
writing manifest file 'dlib.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
Building extension for Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]
Invoking CMake setup: 'cmake D:\Pyton_Pliki\facial_recognition\Lib\site-packages\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\Pyton_Pliki\facial_recognition\Lib\site-packages\build\lib.win32-3.8 -DPYTHON_EXECUTABLE=C:\Users\kubus\AppData\Local\Programs\Python\Python38-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=D:\Pyton_Pliki\facial_recognition\Lib\site-packages\build\lib.win32-3.8'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version  to target Windows 10.0.18362.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_C_COMPILER could be found.


我已经安装了VS 16 2019,并且使用Windows安装程序和VS工具安装了CMake。
我知道问题出在编译器上,但是我该如何安装一个并将CMake指向它呢?

最佳答案

该链接帮助:

docs.microsoft.com/zh-CN/cpp/build/vscpp-step-0-installation

我遵循了使用Visual Studio安装C++编译器的过程,本文已对此进行了详细介绍。之后,我运行python setup.py install,一切正常。

感谢斯塔克!

关于python - CMake在Python Virtualenv中安装DLib时找不到C和C++编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60798167/

相关文章:

python - django:从 View 返回图像数据

Python 迭代器追加逻辑

c++ - 如何实现一个简单的 < 运算符

python - 谷歌应用引擎 : No module named google. API

python - 如何在 IDLE 启动文件中使用 __future__ 分区

c++ - 为什么以及如何在 C++ 中使用命名空间?

c++ - 什么库可用于将位图转换为 vector ?

c++ - 为静态链接构建 gcc

c++ - Google测试:错误LNK2019:带有CMake的Visual Studio 2017的未解析外部符号

c++ - 使用基于编译器的 cmake 条件 CXX_FLAGS?