为 Windows 安装 dlib:“dlib 构建轮失败”和“非零退出状态 1”

Posted

技术标签:

【中文标题】为 Windows 安装 dlib:“dlib 构建轮失败”和“非零退出状态 1”【英文标题】:Installing dlib for Windows: "Failed building wheel for dlib" and "non-zero exit status 1" 【发布时间】:2019-06-26 06:14:16 【问题描述】:

我在 Windows 10 上运行 Python 3.6,并安装了 cmake(通过 pip)、cuda 9.2 和最新版本的 Visual Studio (15.9.6),以及其他地方提到的 2015 v140 工具集组件 (@987654321 @) 这是必要的:

在运行pip install dlib 时,我得到大量输出(此处无法粘贴),但其中包括“dlib 构建轮失败”,最后部分如下:

        9 Warning(s)
        10 Error(s)

    Time Elapsed 00:04:17.30
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\james\AppData\Local\Temp\pip-install-9erypcmb\dlib\setup.py", line 257, in <module>
        'Topic :: Software Development',
      File "c:\users\james\appdata\local\programs\python\python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\users\james\appdata\local\programs\python\python36\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\james\appdata\local\programs\python\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\james\AppData\Local\Temp\pip-install-9erypcmb\dlib\setup.py", line 133, in run
        self.build_extension(ext)
      File "C:\Users\james\AppData\Local\Temp\pip-install-9erypcmb\dlib\setup.py", line 173, in build_extension
        subprocess.check_call(cmake_build, cwd=build_folder)
      File "c:\users\james\appdata\local\programs\python\python36\lib\subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.

    ----------------------------------------
Command "c:\users\james\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\james\\AppData\\Local\\Temp\\pip-install-9erypcmb\\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\james\AppData\Local\Temp\pip-record-21ymtq1y\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\james\AppData\Local\Temp\pip-install-9erypcmb\dlib\

【问题讨论】:

【参考方案1】:

我能够根据https://www.deciphertechnic.com/install-dlib-python-api-on-windows/ 在 conda 环境中安装

【讨论】:

以上是关于为 Windows 安装 dlib:“dlib 构建轮失败”和“非零退出状态 1”的主要内容,如果未能解决你的问题,请参考以下文章

转:Windows系统环境下安装dlib

无法在 Windows 10 上安装 dlib

是否可以在 Windows 7 上安装 dlib?

在 Windows 10 上安装 dlib

在 Windows 10 上安装 dlib 的问题(已安装 Cmake)

无法在Windows 10和Python 3.7上安装dlib