在python上安装dlib软件包时编码问题

时间:2019-08-26 11:11:21

标签: python-3.x dlib

我正在安装“ dlib”软件包。首先,我需要“ cmake”。它已经设置好了。当我运行标准的"dlib-19.17.0.tar.gz setup.py"文件或“ pip”命令时,出现此错误:

  

警告:子进程输出似乎未编码为cp1254

我搜索了此错误类型。我认为这与编码设置代码有关。无论如何,我没有发现相同的问题。使用Python 3.7.0和Pycharm IDE。我已经尝试将程序包安装在cmd和Pycharm内部。

在setup.py注释行中,其状态如下:

        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Science/Research',
        'Intended Audience :: Developers',
        'Operating System :: MacOS :: MacOS X',
        'Operating System :: POSIX',
        'Operating System :: POSIX :: Linux',
        'Operating System :: Microsoft',
        'Operating System :: Microsoft :: Windows',
        'Programming Language :: C++',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Scientific/Engineering',
        'Topic :: Scientific/Engineering :: Artificial Intelligence',
        'Topic :: Scientific/Engineering :: Image Recognition',
        'Topic :: Software Development',

这意味着不能在Python 3.7中使用吗?这是Visual Studio中的Python 3.6环境错误输出:

----- Installing '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: started
    Running setup.py install for dlib: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\XXX\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\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\XXX\AppData\Local\Temp\pip-record-irq2nt_7\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\
    Complete output (66 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.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\build\lib.win-amd64-3.6 -DPYTHON_EXECUTABLE=C:\Users\XXX\AppData\Local\Programs\Python\Python36\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\build\lib.win-amd64-3.6 -A x64'
    -- Building for: Visual Studio 16 2019
    -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17134.
    -- The C compiler identification is MSVC 19.22.27905.0
    -- The CXX compiler identification is MSVC 19.22.27905.0
    -- Check for working C compiler: D:/gfg/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe
    -- Check for working C compiler: D:/gfg/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: D:/gfg/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe
    -- Check for working CXX compiler: D:/gfg/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PythonInterp: C:/Users/XXX/AppData/Local/Programs/Python/Python36/python.exe (found version "3.6.7")
    CMake Error at C:/Users/XXX/AppData/Local/Temp/pip-install-jpw3t5j5/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:155 (message):
      Python libraries not found
    Call Stack (most recent call first):
      C:/Users/XXX/AppData/Local/Temp/pip-install-jpw3t5j5/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:16 (find_package)
      C:/Users/XXX/AppData/Local/Temp/pip-install-jpw3t5j5/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)


    -- Configuring incomplete, errors occurred!
    See also "C:/Users/XXX/AppData/Local/Temp/pip-install-jpw3t5j5/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\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\setup.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\XXX\AppData\Local\Temp\pip-install-jpw3t5j5\dlib\setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:\Users\XXX\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\dlib\\build\\lib.win-amd64-3.6', '-DPYTHON_EXECUTABLE=C:\\Users\\XXX\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\dlib\\build\\lib.win-amd64-3.6', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\XXX\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-jpw3t5j5\\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\XXX\AppData\Local\Temp\pip-record-irq2nt_7\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
----- Failed to install 'dlib' -----

当我隐藏subprocess.CalledProcessError时,带有注释字符,就像在3.7环境中一样:

WARNING: Subprocess output does not appear to be encoded as cp1254

之后,它将调用“成功安装dlib-19.17.0”。当然设置是错误的。无法导入dlib。

任何建议都可以帮助我很多。预先谢谢你。

0 个答案:

没有答案