【问题标题】:VSCode v1.35 - RuntimeError: CMake must be installed to build the following extensions: dlibVSCode v1.35 - RuntimeError: CMake must be installed to build the following extensions: dlib
【发布时间】:2019-11-05 22:53:30
【问题描述】:

我已经在我的 VS Code 1.35 中安装了 pip install cmake 的 CMake,并尝试安装 face_recognition,但它仍然给我一个 RuntimeError。我正在使用'Python 3.7.3,x32'

我还尝试通过pip install dlib 安装dlib,因为这是我无法安装face_recognition 的原因之一。

C:\Users\user>python -m pip install cmake
Requirement already satisfied: cmake in c:\users\user\appdata\roaming\python\python37\site-packages (3.14.4)

C:\Users\user>python -m pip install dlib
Collecting dlib
  Using cached https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
Installing collected packages: dlib
  Running setup.py install for dlib ... error
    ERROR: Complete output from command 'C:\Python\Python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-24vk6act\\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\user\AppData\Local\Temp\pip-record-yf2kdjpx\install-record.txt' --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    package init file 'dlib\__init__.py' not found (or not a regular file)
    running build_ext
    Traceback (most recent call last):
      File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 120, in get_cmake_version
        out = subprocess.check_output(['cmake', '--version'])
      File "C:\Python\Python37\lib\subprocess.py", line 395, in check_output
        **kwargs).stdout
      File "C:\Python\Python37\lib\subprocess.py", line 472, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Python\Python37\lib\subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "C:\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
        startupinfo)
    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:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Python\Python37\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Python\Python37\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Python\Python37\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python\Python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 129, in run
        cmake_version = self.get_cmake_version()
      File "C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\setup.py", line 125, in get_cmake_version
        "\n*******************************************************************\n")
    RuntimeError:
    *******************************************************************
     CMake must be installed to build the following extensions: dlib
    *******************************************************************

    ----------------------------------------
ERROR: Command "'C:\Python\Python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-24vk6act\\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\user\AppData\Local\Temp\pip-record-yf2kdjpx\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-install-24vk6act\dlib\

我希望有人可以帮助我解决这个问题。我是新手,真的是使用 python 的初学者,并尝试了其他问题的不同建议。希望有人会注意到我的问题。谢谢!

【问题讨论】:

    标签: python opencv cmake dlib


    【解决方案1】:

    here下载并安装dlib轮

    然后pip install face_recognition


    • pip install cmake
    • visual studio,单个组件 选项卡,编译器下用于 Cmake 的 Visual C++ 工具复选框,构建工具 和运行时部分
    • 在 Visual Studio 命令提示符下运行,pip install face_recognition

    Source

    【讨论】:

    • 我必须安装 Visual Studio 2019 或任何其他版本吗?即使我只是单独使用 Visual Studio 代码?
    • 或者试试dlib轮
    • 无需安装VSCode。我使用创建 python 虚拟环境版本 3.6 并安装了带有轮文件的dlib,因为它支持最高版本 3.6。然后pip install cmake & 然后pip install face_recognition
    【解决方案2】:

    有用的是... 在得到很多红色错误后,我运行以下

    1. conda install -c conda-forge dlib
    2. pip install cmake
    3. pip install face_recognition

    即使错误提示我重新安装VS Code for c++。但以上顺序安装工作。

    Python version was 3.8
    

    【讨论】:

      【解决方案3】:

      尝试使用 conda 安装 dlib conda install -c conda-forge dlib

      【讨论】:

      • 请提供使用其他包管理器的其他替代安装方法。
      • 这对我有用。首先,您需要有一个 Visual Studio 安装程序,在其中安装 CMake 和其他 Microsoft 构建工具,然后只需按照上述命令安装 dlib,然后安装人脸识别库
      猜你喜欢
      • 1970-01-01
      • 2020-09-06
      • 2021-03-13
      • 2015-08-14
      • 2015-12-17
      • 1970-01-01
      • 2020-06-14
      • 1970-01-01
      • 2022-12-17
      相关资源
      最近更新 更多