Building wheel for dlib (setup.py) ... error
时间: 2023-09-20 13:12:19 浏览: 443
如果在安装`dlib`时出现了类似以下的错误:
```
Building wheel for dlib (setup.py) ... error
```
这通常意味着你需要安装一些依赖项来成功编译`dlib`的安装包。具体来说,`dlib`需要C++编译器和一些其他的C++库来构建其安装包。
对于Linux用户,你可以使用以下命令来安装`dlib`的依赖项:
```
sudo apt-get install build-essential cmake libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev
```
对于Windows用户,你需要先安装C++编译器,例如Visual Studio,然后使用以下命令安装`dlib`的依赖项:
```
pip install numpy scipy matplotlib scikit-image scikit-learn ipython
```
一旦你安装了这些依赖项,你应该可以成功安装`dlib`了。如果你仍然遇到问题,请尝试在安装`dlib`之前更新`pip`和`setuptools`:
```
pip install -U pip setuptools
```
然后再次尝试安装`dlib`:
```
pip install 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 ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects
这个错误提示是因为缺少CMake,它是dlib的构建工具之一。你需要先安装CMake,然后再重新安装dlib。你可以使用以下命令安装CMake:
```
pip install cmake
```
然后再重新安装dlib:
```
pip install dlib
```
如果你在Windows操作系统下安装dlib,还需要安装Visual Studio并安装C++工具。如果你已经安装了Visual Studio,可以使用以下命令安装C++工具:
```
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --passive --norestart
```
安装完C++工具后再使用上面的命令重新安装dlib即可。
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.
这个错误是因为缺少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页面上查找更多信息。
阅读全文