【问题标题】:How to upgrade dlib python package in Windows python 3.6如何在 Windows python 3.6 中升级 dlib python 包
【发布时间】:2023-04-04 16:33:01
【问题描述】:

我正在使用 python3.6 并已在 Windows 10 x64 上使用其轮文件 dlib-19.8.1-cp36-cp36m-win_amd64.whl 安装 dlib。这个wheel文件安装了dlib,但安装的版本是19.8.1。我想将它升级到最新版本的19.20。为此,我使用升级命令 python -m pip install dlib --upgrade 但这给了我以下错误:

Collecting dlib
  Using cached dlib-19.20.0.tar.gz (3.2 MB)
Using legacy setup.py install for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
  Attempting uninstall: dlib
    Found existing installation: dlib 19.8.1
    Uninstalling dlib-19.8.1:
      Successfully uninstalled dlib-19.8.1
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python3.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ABHINA~1\AppData\Local\Temp\pip-record-qdwn8ssd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python3.6\Include\dlib'
         cwd: C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\
    Complete output (55 lines):
    running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=c:\python3.6\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\build\lib.win-amd64-3.6 -A x64'
    -- Building for: NMake Makefiles
    CMake Error at CMakeLists.txt:3 (project):
      Generator

        NMake Makefiles

      does not support platform specification, but platform

        x64

      was specified.


    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/AbhinavRawat/AppData/Local/Temp/pip-install-erx7t440/dlib/build/temp.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "c:\python3.6\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\python3.6\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\python3.6\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\python3.6\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "c:\python3.6\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\python3.6\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\python3.6\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\python3.6\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\ABHINA~1\AppData\Local\Temp\pip-install-erx7t440\dlib\setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "c:\python3.6\lib\subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=c:\\python3.6\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
  Rolling back uninstall of dlib
  Moving to c:\python3.6\lib\site-packages\dlib-19.8.1.dist-info\
   from c:\python3.6\lib\site-packages\~lib-19.8.1.dist-info
  Moving to c:\python3.6\lib\site-packages\dlib\
   from c:\python3.6\lib\site-packages\~lib
ERROR: Command errored out with exit status 1: 'c:\python3.6\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\ABHINA~1\\AppData\\Local\\Temp\\pip-install-erx7t440\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ABHINA~1\AppData\Local\Temp\pip-record-qdwn8ssd\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python3.6\Include\dlib' Check the logs for full command output.

任何人都可以在这里帮助我。谢谢

【问题讨论】:

  • 您收到了Using legacy setup.py install for dlib, since package 'wheel' is not installed. 的消息,您尝试安装wheel 然后再试一次吗?
  • @IainShelvington 是的,我只使用 wheel 文件安装了 dlib,然后进行了升级。让我再试一次
  • 好的,我也安装了 wheel 包,并且还使用 pip install 安装了 dlib,但仍然遇到同样的问题

标签:
python
dlib