当我尝试安装 dlib 时,出现错误:必须安装 CMake 才能构建 dlib,但我已经安装了 cmake

问题描述 投票:0回答:1

我正在 Raspberry Pi Bookworm 上运行,并安装了所有更新。我使用 pip 和 apt 安装了 cmake,并通过运行

cmake --version
验证了这一点,它返回

cmake version 3.29.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

我也运行了

pip list
,它告诉我cmake实际上已经安装了。

我尝试使用 apt 和 pip 安装 cmake,这两者似乎都有效。但是,当我运行

pip install dlib
或使用 pip3 时,它开始工作,但随后出现错误:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting dlib
  Using cached dlib-19.24.4.tar.gz (3.3 MB)
  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
  ╰─> [10 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "/home/argetlam/f_recognition/env/bin/cmake", line 5, in <module>
          from cmake import cmake
      ModuleNotFoundError: No module named 'cmake'
      
      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

我也尝试过升级pip和安装wheel,但都没有成功。我已经浏览了许多堆栈溢出帖子并尝试了所有这些方法。我也尝试过这个:

sudo apt-get update && apt-get install -y cmake
输出这个:

Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian-security bookworm-security InRelease        
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease                  
Hit:4 http://archive.raspberrypi.com/debian bookworm InRelease                 
Ign:5 https://apt.kitware.com/ubuntu bookworm InRelease                        
Err:6 https://apt.kitware.com/ubuntu bookworm Release
  404  Not Found [IP: XX.XXX.XXX.XX 443]
Reading package lists... Done
E: The repository 'https://apt.kitware.com/ubuntu bookworm Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

有人知道我该如何解决这个问题吗?

新更新:

  1. 跑步
    which cmake
    给了我一条不存在的路径
  2. env/lib/python3.11/site-packages/cmake
    中,所有像
    __init__.py
    这样的文件都存在,所有文件都是空的。这对于
    env/lib/python3.11/site-packages/cmake/data
    中的所有文件夹都是相同的。连copyright.txt文件都是空的。
python python-3.x cmake pip dlib
1个回答
0
投票

在故障排除时找到了答案 - 我下载了 .whl 文件,并之前安装了该文件,但所有文件都是空的。我通过运行

pip install --upgrade cmake
解决了这个问题,这让我觉得自己非常愚蠢。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.