dlib安装问题:ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects

 

 

# 问题安装报错。 

复制代码
>pip install dlib
Defaulting to user installation because normal site-packages is not writeable
Collecting dlib
  Downloading dlib-19.24.4.tar.gz (3.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 1.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      running bdist_wheel
      running build
      running build_ext

      ERROR: CMake must be installed to build dlib

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects  ’
复制代码

 

建议使用虚拟环境,太麻烦

 

复制代码
这段文字是关于如何在Python环境下安装dlib库的指南,并且提到了针对不同Python版本和操作系统的解决方案。以下是详细解释:

1. **Python版本兼容性**:作者指出这个解决方案适用于Python 3.73.8和3.9版本。这意味着提供的安装方法在这些版本的Python上经过了测试并可以正常工作。

2. **创建虚拟环境**:建议使用`venv`模块或者Anaconda来创建一个虚拟环境。虚拟环境允许你为不同的项目创建隔离的Python运行环境,避免依赖冲突。

   使用`venv`创建虚拟环境的命令示例:
   ```bash
   python -m venv myenv
   ```
   
   使用Anaconda创建虚拟环境的命令示例:
   ```bash
   conda create -n my_env python=3.8
   ```

3. **下载wheel文件**:作者提到从一个特定的GitHub仓库下载预编译的dlib wheel文件。Wheel文件是Python的二进制分发格式,可以加速安装过程,因为它避免了编译步骤。

4. **安装dlib**:在终端中使用pip命令安装下载的wheel文件。示例命令格式如下:
   ```bash
   python -m pip install dlib-19.22.99-cp38-cp38-win_amd64.whl
   ```
   这里的`dlib-19.22.99-cp38-cp38-win_amd64.whl`是wheel文件的名称,表明它是为Python 3.8(`cp38`)在Windows 64位系统(`win_amd64`)上编译的。

5. **更新信息**- **2023年12月更新**:提到如果用户在为dlib构建wheel时遇到问题,可以使用另一个包含Python 3.10和3.11 wheel文件的GitHub仓库。
   - **2024年5月更新**:该仓库现在也包含了Python 3.12的wheel文件。

6. **系统限制**:最后,作者注明这些wheel文件只能用来在Windows 64位操作系统上安装dlib。 
复制代码

 

 可行的安装方法;

https://github.com/davisking/dlib/issues/2943

 

pip install cmake==3.25.2  -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install dlib==19.24.2  -i https://pypi.tuna.tsinghua.edu.cn/simple

 

 

 

posted @   aiplus  阅读(2351)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
悬浮按钮示例
点击右上角即可分享
微信分享提示