繁体   English   中英

当 Cmake 报告错误并且重新安装不起作用时,如何在 macOS 中安装 dlib

[英]How can I install dlib in macOS when Cmake is reporting error and re-install doesn't work

尝试为 face_recognition 下载dlib ,已经下载了 openCV 但在此过程中遇到错误/

我努力了:

  1. pip install dlibpip3 install dlib
  2. brew install dlib

我在 1 中遇到了同样的错误,在 2 中遇到了不同的错误,如下:

“Error: The following formula
[#, #]
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
xcode-select –install”

然后我尝试运行xcode-select –intall并且也失败了......

无论如何,为了您阅读方便,我将尝试先为您手动挑选错误突出显示,如下所示:

_"ERROR: Command errored out with exit status 1:”_


_“package init file ‘dlib/__init__.py’ not found (or not a regular file)”_


_“Invoking CMake setup:…..
The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: /usr/bin/cc — broken”_


_“The C compiler . “/usr/bin/cc” . is not able to compile a simple test program.”_


_“CMake will not be able to correctly generate this project.”_


_” — Configuring incomplete, errors occurred!”_


_“ERROR: 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
ERROR: Command errored out with exit status 1:”_

-----------------------------------------------------------
Collecting dlib
Using cached https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz

#error starts here

Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /Users/bear/.virtualenvs/py3_dlib/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘; __file__='”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/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 /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-wheel-vlvkpttg –python-tag cp37
cwd: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/
Complete output (67 lines):
running bdist_wheel
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.7.3 (default, Mar 27 2019, 16:54:48)
Invoking CMake setup: ‘cmake /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7 -DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3 -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is unknown
— The CXX compiler identification is unknown
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — broken
CMake Error at /usr/local/Cellar/cmake/3.15.3/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

“/usr/bin/cc”

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_cc287/fast && xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

— Configuring incomplete, errors occurred!
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeOutput.log”.
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 261, in
‘Topic :: Software Development’,
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/setuptools/__init__.py”, line 145, in setup
return distutils.core.setup(**attrs)
File “/anaconda3/lib/python3.7/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 966, in run_commands
self.run_command(cmd)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/wheel/bdist_wheel.py”, line 192, in run
self.run_command(‘build’)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/anaconda3/lib/python3.7/distutils/command/build.py”, line 135, in run
self.run_command(cmd_name)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 135, in run
self.build_extension(ext)
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File “/anaconda3/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7’, ‘-DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1.
—————————————-
ERROR: 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
ERROR: Command errored out with exit status 1:
command: /Users/bear/.virtualenvs/py3_dlib/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘; __file__='”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/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 /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-record-wwx0654z/install-record.txt –single-version-externally-managed –compile –install-headers /Users/bear/.virtualenvs/py3_dlib/include/site/python3.7/dlib
cwd: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/
Complete output (69 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.7.3 (default, Mar 27 2019, 16:54:48)
Invoking CMake setup: ‘cmake /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7 -DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3 -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is unknown
— The CXX compiler identification is unknown
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — broken
CMake Error at /usr/local/Cellar/cmake/3.15.3/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

“/usr/bin/cc”

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_648b7/fast && xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

— Configuring incomplete, errors occurred!
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeOutput.log”.
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 261, in
‘Topic :: Software Development’,
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/setuptools/__init__.py”, line 145, in setup
return distutils.core.setup(**attrs)
File “/anaconda3/lib/python3.7/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 966, in run_commands
self.run_command(cmd)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/setuptools/command/install.py”, line 61, in run
return orig.install.run(self)
File “/anaconda3/lib/python3.7/distutils/command/install.py”, line 545, in run
self.run_command(‘build’)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/anaconda3/lib/python3.7/distutils/command/build.py”, line 135, in run
self.run_command(cmd_name)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 135, in run
self.build_extension(ext)
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File “/anaconda3/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7’, ‘-DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1.
—————————————-
ERROR: Command errored out with exit status 1: /Users/bear/.virtualenvs/py3_dlib/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘; __file__='”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/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 /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-record-wwx0654z/install-record.txt –single-version-externally-managed –compile –install-headers /Users/bear/.virtualenvs/py3_dlib/include/site/python3.7/dlib Check the logs for full command output.

试试这个链接

如何解决安装 Dlib 的错误? .

python 3.6 到 3.7.0 支持 dlib 19.17,如果 dlib 版本高于则它会导致 numpy 错误

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM