You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows10下Python3.7安装dlib(人脸识别)报错的解决方法咨询

Fixing Dlib Installation Error on Windows 10 (Python 3.7)

Hey there, let's break down why you're hitting this error and fix it step by step. The core issues here are:

  • CMake is trying to use the NMake Makefiles generator, which doesn't support specifying the x64 platform
  • Your environment is missing a proper C/C++ compiler required to build dlib from source

Here are two reliable solutions to get dlib installed:

Option 1: Use a Pre-built Wheel (Easiest & Fastest)

Building from source is error-prone on Windows. Instead, use a pre-compiled wheel package tailored for your Python 3.7 64-bit environment:

  1. Find the correct dlib wheel file matching Python 3.7 and Windows 64-bit (look for a file named something like dlib-19.18.0-cp37-cp37m-win_amd64.whl)
  2. Download it to your local machine
  3. Open a command prompt, navigate to the folder where you saved the wheel, and run:
    pip install dlib-19.18.0-cp37-cp37m-win_amd64.whl
    

This skips the entire source compilation process and gets you up and running in minutes.

Option 2: Fix Source Compilation (If You Need to Build From Source)

If you must build dlib from source, follow these steps to configure your environment correctly:

  1. Install Visual Studio Build Tools

    • Download and install Visual Studio Build Tools (2017 or newer)
    • During installation, select the Desktop development with C++ workload
    • Ensure the following components are checked:
      • MSVC v141 (or newer) C++ x64/x86 build tools
      • Windows 10 SDK
      • CMake tools for Windows
  2. Use the Correct Command Prompt

    • Don't use a regular command prompt or Anaconda prompt. Instead, open the x64 Native Tools Command Prompt for VS 20XX (matches your installed VS version)
    • This prompt automatically configures all environment variables for the 64-bit C/C++ compiler and CMake
  3. Re-run the Installation

    • Navigate to your extracted dlib folder in the VS command prompt
    • Run either of these commands:
      python setup.py install
      
      or
      pip install .
      

Why This Works

The VS Native Tools Command Prompt sets up the correct compiler paths and tells CMake to use the MSBuild generator (instead of NMake), which fully supports the x64 platform specification. This fixes both the generator and compiler missing errors you saw earlier.

内容的提问来源于stack exchange,提问作者Sri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:41:58