关于安装python包dlib以及包face_recognition导入失败出现以下情况的解决办法

错误信息
Collecting dlib
Using cached https://files.pythonhosted.org/packages/54/ff/5781a11bdc0d1c90a813f3f66d460abf628e5114856a842d18d43f709a7a/dlib-19.10.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-ZA44JR/dlib/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/pip-wheel-9SSCJL --python-tag cp27:
running bdist_wheel
running build
running build_py
package init file ‘dlib/init.py’ not found (or not a regular file)
running build_ext
Invoking CMake setup: ‘cmake /tmp/pip-install-ZA44JR/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-ZA44JR/dlib/build/lib.linux-i686-2.7 -DPYTHON_EXECUTABLE=/usr/bin/python -DCMAKE_BUILD_TYPE=Release’
– The C compiler identification is GNU 4.4.7
– The CXX compiler identification is GNU 4.4.7
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Found PythonInterp: /usr/bin/python (found version “2.7.14”)
– Found PythonLibs: /usr/local/python27/lib/libpython2.7.so
– Performing Test HAS_CPP14_FLAG
– Performing Test HAS_CPP14_FLAG - Failed
– Performing Test HAS_CPP11_FLAG
– Performing Test HAS_CPP11_FLAG - Failed
CMake Error at /tmp/pip-install-ZA44JR/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:32 (message):
Unsupported compiler – pybind11 requires C++11 support!
Call Stack (most recent call first):
/tmp/pip-install-ZA44JR/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)

– Configuring incomplete, errors occurred!
See also “/tmp/pip-install-ZA44JR/dlib/build/temp.linux-i686-2.7/CMakeFiles/CMakeOutput.log”.
See also “/tmp/pip-install-ZA44JR/dlib/build/temp.linux-i686-2.7/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-ZA44JR/dlib/setup.py”, line 249, in
‘Topic :: Software Development’,
File “/usr/local/python27/lib/python2.7/site-packages/setuptools/init.py”, line 129, in setup
return distutils.core.setup(**attrs)
File “/usr/local/python27/lib/python2.7/distutils/core.py”, line 151, in setup
dist.run_commands()
File “/usr/local/python27/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/local/python27/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/local/python27/lib/python2.7/site-packages/wheel/bdist_wheel.py”, line 204, in run
self.run_command(‘build’)
File “/usr/local/python27/lib/python2.7/distutils/cmd.py”, line 326, in run_command
self.distribution.run_command(command)
File “/usr/local/python27/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/local/python27/lib/python2.7/distutils/command/build.py”, line 127, in run
self.run_command(cmd_name)
File “/usr/local/python27/lib/python2.7/distutils/cmd.py”, line 326, in run_command
self.distribution.run_command(command)
File “/usr/local/python27/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/tmp/pip-install-ZA44JR/dlib/setup.py”, line 129, in run
self.build_extension(ext)
File “/tmp/pip-install-ZA44JR/dlib/setup.py”, line 163, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File “/usr/local/python27/lib/python2.7/subprocess.py”, line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/tmp/pip-install-ZA44JR/dlib/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-ZA44JR/dlib/build/lib.linux-i686-2.7’, ‘-DPYTHON_EXECUTABLE=/usr/bin/python’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1


Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-ZA44JR/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 /tmp/pip-record-EBLzit/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
package init file ‘dlib/init.py’ not found (or not a regular file)
running build_ext
Invoking CMake setup: ‘cmake /tmp/pip-install-ZA44JR/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-ZA44JR/dlib/build/lib.linux-i686-2.7 -DPYTHON_EXECUTABLE=/usr/bin/python -DCMAKE_BUILD_TYPE=Release’
– The C compiler identification is GNU 4.4.7
– The CXX compiler identification is GNU 4.4.7
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Found PythonInterp: /usr/bin/python (found version “2.7.14”)
– Found PythonLibs: /usr/local/python27/lib/libpython2.7.so
– Performing Test HAS_CPP14_FLAG
– Performing Test HAS_CPP14_FLAG - Failed
– Performing Test HAS_CPP11_FLAG
– Performing Test HAS_CPP11_FLAG - Failed
CMake Error at /tmp/pip-install-ZA44JR/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:32 (message):
Unsupported compiler – pybind11 requires C++11 support!
Call Stack (most recent call first):
– Performing Test HAS_CPP14_FLAG
– Performing Test HAS_CPP14_FLAG - Failed
– Performing Test HAS_CPP11_FLAG
– Performing Test HAS_CPP11_FLAG - Failed
CMake Error at /tmp/pip-install-ZA44JR/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:32 (message):
Unsupported compiler – pybind11 requires C++11 support!
Call Stack (most recent call first):
/tmp/pip-install-ZA44JR/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)

-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-ZA44JR/dlib/build/temp.linux-i686-2.7/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-ZA44JR/dlib/build/temp.linux-i686-2.7/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-ZA44JR/dlib/setup.py", line 249, in <module>
    'Topic :: Software Development',
  File "/usr/local/python27/lib/python2.7/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/python27/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/python27/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/local/python27/lib/python2.7/distutils/command/install.py", line 563, in run
    self.run_command('build')
  File "/usr/local/python27/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/python27/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/local/python27/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-ZA44JR/dlib/setup.py", line 129, in run
    self.build_extension(ext)
  File "/tmp/pip-install-ZA44JR/dlib/setup.py", line 163, in build_extension
    subprocess.check_call(cmake_setup, cwd=build_folder)
  File "/usr/local/python27/lib/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-ZA44JR/dlib/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-ZA44JR/dlib/build/lib.linux-i686-2.7', '-DPYTHON_EXECUTABLE=/usr/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1

----------------------------------------

Command “/usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-ZA44JR/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 /tmp/pip-record-EBLzit/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-install-ZA44JR/dlib/

在这种情况下 需要下载安装CMake以及boost
具体方法在https://blog.csdn.net/ezhchai/article/details/79087046这位大大这里可以看到

如果安装成功后还不行,则检查自己的python版本,是否对应dlib版本,如果不对应则升级或降级至对应版本。
例如层主的安装的最新版的3.7,而dlib并无对应版本可以下载 ,因此降级至3.6,然后就成功了
降级命令为conda install python=3.6

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值