最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

關于python中DLIB包無法安裝問題解決辦法

 更新時間:2026年01月16日 10:12:39   作者:學不會的某楊  
dlib一個在計算機視覺和機器學習領域尤其是人臉識別中廣泛應用的庫,其安裝過程往往令開發(fā)者頭疼不已,這篇文章主要介紹了關于python中DLIB包無法安裝問題解決辦法,需要的朋友可以參考下

本文章是基于VScode的dlib包無法安裝的解決方案。

Cmake支持

問題描述(錯誤碼展示)

Collecting dlib
  Using cached dlib-19.24.9.tar.gz (3.4 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml): started
  Building wheel for dlib (pyproject.toml): finished with status 'error'
Failed to build dlib
Note: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [48 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "e:\python310\lib\runpy.py", line 196, in _run_module_as_main
          return _run_code(code, main_globals, None,
        File "e:\python310\lib\runpy.py", line 86, in _run_code
          exec(code, run_globals)
        File "E:\python310\Scripts\cmake.exe\__main__.py", line 4, in <module>
      ModuleNotFoundError: No module named 'cmake'
      
      ================================================================================
      ================================================================================
      ================================================================================
      
                         CMake is not installed on your system!
      
          Or it is possible some broken copy of cmake is installed on your system.
          It is unfortunately very common for python package managers to include
          broken copies of cmake.  So if the error above this refers to some file
          path to a cmake file inside a python or anaconda or miniconda path then you
          should delete that broken copy of cmake from your computer.
      
          Instead, please get an official copy of cmake from one of these known good
          sources of an official cmake:
              - cmake.org (this is how windows users should get cmake)
              - apt install cmake (for Ubuntu or Debian based systems)
              - yum install cmake (for Redhat or CenOS based systems)
      
          On a linux machine you can run `which cmake` to see what cmake you are
          actually using.  If it tells you it's some cmake from any kind of python
          packager delete it and install an official cmake.
      
          More generally, cmake is not installed if when you open a terminal window
          and type
             cmake --version
          you get an error.  So you can use that as a very basic test to see if you
          have cmake installed.  That is, if cmake --version doesn't run from the
          same terminal window from which you are reading this error message, then
          you have not installed cmake.  Windows users should take note that they
          need to tell the cmake installer to add cmake to their PATH.  Since you
          can't run commands that are not in your PATH.  This is how the PATH works
          on Linux as well, but failing to add cmake to the PATH is a particularly
          common problem on windows and rarely a problem on Linux.
      
      ================================================================================
      ================================================================================
      ================================================================================
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)

上述一段描述,主要簡化為兩點:(1)dlib包無法安裝,在下載過程中暫停。(2)系統(tǒng)描述問題為缺少Cmake支持。

原因是由于dlib 是一個依賴 CMake 進行編譯的 C++ 庫,因此必須先正確安裝 CMake。

需要注意的是,Cmake不是python中的包。而是一款軟件,需要在Cmake下載官網(wǎng)下載。

裝載流程

在電腦上下載Windows x64 Installer:。在等待過程中可以通過WIN+R調(diào)出任務運行框,                                

通過命令CMD調(diào)出管理員窗口,通過輸入cmake --version查看是否安裝Cmake或者安裝的版本號。

如果在安裝前試圖在python的包中下載了相應名稱的包,請卸載相應的包,或者通過在終端中輸入pip  uninstall Cmake一鍵卸載。

安裝步驟

打開安裝程序                

選擇ACCEPT                

選擇添加到系統(tǒng)路徑                      ???????     

可以選擇C盤以外的路徑    ???????        ???????                        

然后一直安裝,等待安裝完成。

關于在VScode中出現(xiàn)的其他問題

問題描述

Collecting dlib
  Using cached dlib-19.24.9.tar.gz (3.4 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: dlib
  Building wheel for dlib (pyproject.toml): started
  Building wheel for dlib (pyproject.toml): finished with status 'error'
Failed to build dlib
Note: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  × Building wheel for dlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [75 lines of output]
      running bdist_wheel
      running build
      running build_ext
      <string>:163: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      Building extension for Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
      Invoking CMake setup: 'cmake C:\Users\Dell\AppData\Local\Temp\pip-install-8plz3w9k\dlib_1368adfa47b846dba7b10d50343adf33\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Dell\AppData\Local\Temp\pip-install-8plz3w9k\dlib_1368adfa47b846dba7b10d50343adf33\build\lib.win-amd64-cpython-310 -DPYTHON_EXECUTABLE=e:\python310\python.exe -DDLIB_USE_FFMPEG=OFF -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Dell\AppData\Local\Temp\pip-install-8plz3w9k\dlib_1368adfa47b846dba7b10d50343adf33\build\lib.win-amd64-cpython-310 -A x64'
      -- Building for: NMake Makefiles
      CMake Error at CMakeLists.txt:5 (message):
      
      
      
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      
        You must use Visual Studio to build a python extension on windows.  If you
        are getting this error it means you have not installed Visual C++.  Note
        that there are many flavors of Visual Studio, like Visual Studio for C#
        development.  You need to install Visual Studio for C++.
      
      
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      
      
      
      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "e:\python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
        File "e:\python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
        File "e:\python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 280, in build_wheel
          return _build_backend().build_wheel(
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\build_meta.py", line 435, in build_wheel
          return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\build_meta.py", line 423, in _build
          return self._build_with_temp_dir(
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in _build_with_temp_dir
          self.run_setup()
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 243, in <module>
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\__init__.py", line 115, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup
          return run_commands(dist)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands
          dist.run_commands()
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands
          self.run_command(cmd)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command
          super().run_command(command)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command
          cmd_obj.run()
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\command\bdist_wheel.py", line 370, in run
          self.run_command("build")
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command
          super().run_command(command)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command
          cmd_obj.run()
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
          self.run_command(cmd_name)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command
          super().run_command(command)
        File "C:\Users\Dell\AppData\Local\Temp\pip-build-env-wthjcxg8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command
          cmd_obj.run()
        File "<string>", line 168, in run
        File "<string>", line 206, in build_extension
        File "e:\python310\lib\subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-8plz3w9k\\dlib_1368adfa47b846dba7b10d50343adf33\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-8plz3w9k\\dlib_1368adfa47b846dba7b10d50343adf33\\build\\lib.win-amd64-cpython-310', '-DPYTHON_EXECUTABLE=e:\\python310\\python.exe', '-DDLIB_USE_FFMPEG=OFF', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-8plz3w9k\\dlib_1368adfa47b846dba7b10d50343adf33\\build\\lib.win-amd64-cpython-310', '-A', 'x64']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dlib
ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)

以上一段報錯表示雖然已經(jīng)下載了Cmake,但是Python環(huán)境無法編譯以 C++編寫的支持需要下載Visual Studio 構(gòu)建工具作為幫助。下載地址為Microsoft C++ 生成工具 - Visual Studio。

安裝 Visual Studio 構(gòu)建工具        

直接點擊下載生成工具,下載完成后開始安裝。

在安裝程序中,選擇以下組件:

  1. “使用 C++ 的桌面開發(fā)”(核心組件,必須選擇)。
  2. “C++ CMake 工具”(用于支持 CMake 編譯)。
  3. Windows SDK(通常最新版本即可,如 10.0.22621.0)。

  4. 完成安裝

    安裝過程可能需要 30 分鐘到 1 小時,具體取決于網(wǎng)絡速度和系統(tǒng)性能。簡易過一段時間要去看一下偶爾會因為各種原因中斷,選擇繼續(xù)下載就行。

現(xiàn)在我們可以下載DLIB了

使用PIP方法下載DLIB

通過命令CMD調(diào)出管理員窗口,通過輸入cmake --version驗證是否安裝Cmake或者安裝的版本號。  

然后可以在編譯界面的終端窗口輸入pip install dlib完成安裝程序。

附錄

另附部分可用dlib官方模型下載地址。建議使用時去看一下dlib官方網(wǎng)頁??的Python實例代碼去了解各個模型的使用方式和規(guī)范。注意下載到的模型一般是DLIB模型是壓縮文件,一般要解壓為dat文件并與編寫的代碼放置于同一目錄下才可以使用。

到此這篇關于關于python中DLIB包無法安裝問題解決辦法的文章就介紹到這了,更多相關python中DLIB包無法安裝問題內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • Python?yaml格式配置文件操作實戰(zhàn)教程

    Python?yaml格式配置文件操作實戰(zhàn)教程

    yaml是專門用來寫配置文件的語言,非常簡潔和強大,用ini也能寫配置文件,看了yaml后,發(fā)現(xiàn)這個更直觀,更方便,有點類似于json格式,這篇文章主要介紹了Python?yaml格式配置文件操作的相關資料,需要的朋友可以參考下
    2025-11-11
  • 使用SQLAlchemy操作數(shù)據(jù)庫表過程解析

    使用SQLAlchemy操作數(shù)據(jù)庫表過程解析

    這篇文章主要介紹了使用SQLAlchemy操作數(shù)據(jù)庫表過程解析,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2020-06-06
  • Python標準庫shutil用法實例詳解

    Python標準庫shutil用法實例詳解

    這篇文章主要介紹了Python標準庫shutil用法,結(jié)合實例形式分析了shutil庫針對文件與文件夾各種常見操作技巧與相關使用注意事項,需要的朋友可以參考下
    2018-08-08
  • 詳解pygame捕獲鍵盤事件的兩種方式

    詳解pygame捕獲鍵盤事件的兩種方式

    這篇文章主要介紹了詳解pygame捕獲鍵盤事件的兩種方式,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2021-04-04
  • python flask編寫一個簡易的web端程序(附demo)

    python flask編寫一個簡易的web端程序(附demo)

    Flask 是一個用于構(gòu)建 Web 應用程序的輕量級 Python Web 框架,本文將使用Python和flask開發(fā)一個簡易的web端程序,需要的小伙伴可以了解下
    2025-09-09
  • 詳解pandas.DataFrame.plot() 畫圖函數(shù)

    詳解pandas.DataFrame.plot() 畫圖函數(shù)

    這篇文章主要介紹了詳解pandas.DataFrame.plot()畫圖函數(shù),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-06-06
  • Python全景系列之裝飾器使用的全面講解

    Python全景系列之裝飾器使用的全面講解

    裝飾器在Python中扮演了重要的角色,文將深入探討裝飾器的所有相關主題,包括裝飾器的基礎知識、實現(xiàn)與使用、工作原理等,需要的可以參考一下
    2023-05-05
  • Pytorch實現(xiàn)GoogLeNet的方法

    Pytorch實現(xiàn)GoogLeNet的方法

    今天小編就為大家分享一篇Pytorch實現(xiàn)GoogLeNet的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-08-08
  • python 判斷是否為正小數(shù)和正整數(shù)的實例

    python 判斷是否為正小數(shù)和正整數(shù)的實例

    這篇文章主要介紹了python 判斷是否為正小數(shù)和正整數(shù)的實例的相關資料,這里提供實例,實例注釋說明很清楚,需要的朋友可以參考下
    2017-07-07
  • 基于python編寫的shell腳本詳細講解

    基于python編寫的shell腳本詳細講解

    python相對于linux的shell腳本來說更簡單,功能更強大,代碼量也少很多,這里就為大家分享一下
    2021-09-09

最新評論

闸北区| 海原县| 波密县| 庆城县| 永嘉县| 泰和县| 旬邑县| 南通市| 泽库县| 永泰县| 辽中县| 德庆县| 临汾市| 丹寨县| 阿勒泰市| 苏尼特右旗| 泾阳县| 徐水县| 营口市| 肥东县| 博野县| 迭部县| 全南县| 达拉特旗| 湖南省| 巨野县| 邓州市| 苏州市| 廊坊市| 于田县| 喀什市| 连平县| 松滋市| 甘南县| 晋州市| 滁州市| 正定县| 西昌市| 金塔县| 菏泽市| 荔波县|