Preparing metadata (setup.py) ... done Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [7 lines of output] running bdist_wheel running build running build_py 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 Running setup.py clean for dlib Failed to build dlib Installing collected packages: dlib Running setup.py install for dlib ... error error: subprocess-exited-with-error × Running setup.py install for dlib did not run successfully. │ exit code: 1 ╰─> [9 lines of output] running install D:\Anaconda3\Anaconda\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py 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: legacy-install-failure × Encountered error while trying to install package. ╰─> dlib note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
时间: 2024-02-15 14:28:22 浏览: 57
这个错误是因为缺少CMake,dlib需要使用CMake进行编译。您需要先安装CMake,然后再重新安装dlib库。以下是在Windows上安装CMake和dlib的步骤:
1. 下载CMake安装程序:您可以从CMake的官方网站 https://cmake.org/download/ 下载适合您的操作系统的CMake安装程序。
2. 安装CMake:运行下载的CMake安装程序,按照提示进行安装。
3. 安装dlib库:在命令行中输入以下命令来安装dlib库:
```
pip install dlib
```
如果您已经安装了dlib库,可以使用以下命令卸载它:
```
pip uninstall dlib
```
然后再重新安装dlib库:
```
pip install dlib
```
如果您还遇到了其他问题,请参考dlib的文档或在dlib的GitHub页面上查找更多信息。
相关问题
Preparing metadata (setup.py) ... error
以下是解决"Preparing metadata (setup.py) ... error"的方法:
1. 确保你的Python环境已经正确安装并配置。可以使用以下命令检查Python版本:
```shell
python --version
```
2. 确保你的pip工具是最新版本。可以使用以下命令升级pip:
```shell
python -m pip install --upgrade pip
```
3. 确保你的项目目录下有正确的setup.py文件。setup.py文件是用于构建、安装和分发Python模块的脚本文件。
4. 检查setup.py文件中是否存在语法错误或其他问题。你可以使用以下命令检查setup.py文件:
```shell
python setup.py check
```
5. 如果你使用的是第三方库,可以尝试从非官方网站下载并安装。例如,你可以从https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame 下载pygame库的.whl文件,然后使用以下命令进行安装:
```shell
pip install pygame‑1.9.6‑cp37‑cp37m‑win_amd64.whl
```
Preparing metadata (setup.py) ... -
在Python中,当你创建一个包或者模块时,你可以使用一个名为`setup.py`的文件来定义一些元数据,以便其他人可以更好地了解和使用你的代码。这个文件通常用于构建和安装Python包。
在`setup.py`文件中,你可以指定一些关于你的包的信息,例如包的名称、版本、作者、描述等。这些信息将被用于生成包的元数据,以便其他人可以通过查看这些元数据来了解你的包。
当你运行`setup.py`文件时,它会执行一些操作,例如检查依赖项、编译扩展模块、复制文件等。这些操作将帮助你准备好你的包,以便可以进行安装或分发。
总结一下,`setup.py`文件是用于定义和准备Python包的元数据和操作的文件。它是构建和安装Python包的重要组成部分。