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

Windows10下Python3.5.2安装face_recognition报错求助

解决face_recognition安装失败的问题

Hey there, let's get this sorted out for you. Looking at your error logs, the core issue is with cmake not working properly when trying to compile the required dlib 19.16.0 version—face_recognition requires dlib >=19.7, which is why pip tried to uninstall your existing 19.1.0, but the compilation failed due to cmake issues.

问题根源

The key errors pointing us to the problem are:

  • ImportError: cannot import name 'cmake' from your Python's cmake.exe script
  • subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1

This means the cmake you're using is likely the Python package version, not a proper system-level cmake installation—and that Python package is broken or incompatible with building dlib.

分步解决方案

Let's fix this step by step:

  1. 移除有问题的Python版cmake包
    打开命令提示符,执行:

    pip uninstall cmake -y
    

    这会删掉导致导入错误的Python版cmake。

  2. 安装系统级的cmake

    • 下载Windows版的官方cmake安装程序(注意匹配你的系统架构:32位或64位)
    • 安装时务必勾选“将cmake添加到系统PATH”选项(可选为所有用户或当前用户)
    • 打开新的命令提示符,验证安装成功:
      cmake --version
      
      你应该能看到有效的版本号(dlib编译要求cmake至少3.8,所以任何新版本都可以)。
  3. 安装适配Python 3.5的预编译dlib wheel包(避免源码编译)
    Windows下源码编译dlib容易出问题,直接用预编译的wheel更稳妥:

    • 找到对应Python 3.5和系统架构的dlib wheel文件(比如64位系统对应dlib-19.16.0-cp35-cp35m-win_amd64.whl)
    • 用pip安装:
      pip install path/to/your/dlib-wheel-file.whl
      

    注意:把path/to/your/dlib-wheel-file.whl替换成你保存wheel文件的实际路径

  4. 最终安装face_recognition
    确认dlib 19.16.0(或更高版本)安装成功后,执行:

    pip install face_recognition
    

额外注意事项

  • 确保你用的是Python 3.5对应的pip——执行pip --version,确认路径指向c:\python35\Scripts\pip.exe
  • 如果之前有过失败的安装尝试,先清理残留:
    pip uninstall dlib face_recognition -y
    
    再重新执行上面的步骤。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 09:03:50