如何解决必须安装 CMake 才能构建以下扩展:PyCha

How to solve CMake must be installed to build the following extensions: dlib in PyCharm?(如何解决必须安装 CMake 才能构建以下扩展:PyCharm 中的 dlib?)

本文介绍了如何解决必须安装 CMake 才能构建以下扩展:PyCharm 中的 dlib?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为 OpenCV 项目安装 dlib 时遇到以下错误.这表明

Facing the following error while installing dlib for the OpenCV project. It shows that

必须安装 CMake 才能构建以下扩展:dlib.

CMake must be installed to build the following extensions: dlib.

命令输出:

Collecting dlib==19.18.0
  Using cached dlib-19.18.0.tar.gz (3.1 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
    Running setup.py install for dlib: started
    Running setup.py install for dlib: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'D:Install Drivepython.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py'"'"'; __file__='"'"'C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersmahmuAppDataLocalTemppip-record-mjm6k3c3install-record.txt' --single-version-externally-managed --compile --install-headers 'D:Install DriveIncludedlib'
         cwd: C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlib
    Complete output (57 lines):
    running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    warning: build_py: byte-compiling is disabled, skipping.
    
    running build_ext
    Traceback (most recent call last):
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 120, in get_cmake_version
        out = subprocess.check_output(['cmake', '--version'])
      File "D:Install Drivelibsubprocess.py", line 424, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "D:Install Drivelibsubprocess.py", line 505, in run
        with Popen(*popenargs, **kwargs) as process:
      File "D:Install Drivelibsubprocess.py", line 951, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "D:Install Drivelibsubprocess.py", line 1420, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 223, in <module>
        setup(
      File "D:Install Drivelibsite-packagessetuptools\__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "D:Install Drivelibdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "D:Install Drivelibdistutilsdist.py", line 966, in run_commands
        self.run_command(cmd)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "D:Install Drivelibsite-packagessetuptoolscommandinstall.py", line 61, in run
        return orig.install.run(self)
      File "D:Install Drivelibdistutilscommandinstall.py", line 546, in run
        self.run_command('build')
      File "D:Install Drivelibdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "D:Install Drivelibdistutilscommanduild.py", line 135, in run
        self.run_command(cmd_name)
      File "D:Install Drivelibdistutilscmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:Install Drivelibdistutilsdist.py", line 985, in run_command
        cmd_obj.run()
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 129, in run
        cmake_version = self.get_cmake_version()
      File "C:UsersmahmuAppDataLocalTemppip-install-a4s1a_zhdlibsetup.py", line 122, in get_cmake_version
        raise RuntimeError("
*******************************************************************
" +
    RuntimeError:
    *******************************************************************
     CMake must be installed to build the following extensions: dlib
    *******************************************************************
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:Install Drivepython.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py'"'"'; __file__='"'"'C:\Users\mahmu\AppData\Local\Temp\pip-install-a4s1a_zh\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersmahmuAppDataLocalTemppip-record-mjm6k3c3install-record.txt' --single-version-externally-managed --compile --install-headers 'D:Install DriveIncludedlib' Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.
You should consider upgrading via the 'D:Install Drivepython.exe -m pip install --upgrade pip' command.

推荐答案

请注意,在输出中必须安装 CMake 才能构建以下扩展:dlib".所以先安装 CMake,然后再尝试安装 dlib.如果安装了 CMake,请尝试通过D:Install Drivepython.exe -m pip install --upgrade pip"将您的 pip 版本更新到 21.1.2.

Notice that in the output that "CMake must be installed to build the following extensions: dlib". So install CMake first and only then try to install dlib. If CMake is installed, try updating your pip version to 21.1.2 via "D:Install Drivepython.exe -m pip install --upgrade pip".

这篇关于如何解决必须安装 CMake 才能构建以下扩展:PyCharm 中的 dlib?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何解决必须安装 CMake 才能构建以下扩展:PyCha

基础教程推荐