首页 > 解决方案 > Jupyter Notebook - 找不到 CMAKE_CXX_COMPILER

问题描述

我想在 Jupyter Notebook 中运行我的程序,但我需要先使用 pip3 install face_recognition 安装 face_recognition。但我不断收到这个错误

错误:命令出错,退出状态为 1:命令:/home/opc/py36env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"'; file ='"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)( file ) if os.path.exists( file ) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\ r\n'"'"', '"'"'\n'"'"');
完整输出(56 行): running bdist_wheel running build
running build_py package init file 'tools/python/dlib/ init.py' 未找到(或不是常规文件)运行 build_ext 构建 Python 3.6.8 扩展(默认,2021 年 3 月 9 日,15:08:44) 调用 CMake 设置:'cmake /tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3 /tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/lib.linux-x86_64-3.6 -DPYTHON_EXECUTABLE=/home/opc/py36env/bin/python3 -DCMAKE_BUILD_TYPE=Release标识是 GNU 4.8.5 -- CXX 编译器标识未知 -- 检测 C 编译器 ABI 信息 -- 检测 C 编译器 ABI 信息 - 完成 -- 检查工作 C 编译器:/usr/bin/cc - 已跳过 -- 检测 C编译功能 - 检测 C 编译功能 - 在 CMakeLists.txt:14 (项目) 完成 CMake 错误:找不到 CMAKE_CXX_COMPILER。

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

-- 配置不完整,出现错误!另请参见“/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log”。另请参见“/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log”。回溯(最后一次调用):文件“”,第 1 行,文件“/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py”,第 261 行,“主题 :: 软件开发”,文件“/home /opc/py36env/lib64/python3.6/site-packages/setuptools/init _.py”,第 153 行,在设置中返回 distutils.core.setup(**attrs) 文件“/usr/lib64/python3.6/distutils/core.py”,第 148 行,在设置中 dist.run_commands() 文件“ /usr/lib64/python3.6/distutils/dist.py”,第 955 行,在 run_commands self.run_command(cmd) 文件“/usr/lib64/python3.6/distutils/dist.py”,第 974 行,在 run_command cmd_obj.run() 文件“/home/opc/py36env/lib64/python3.6/site-packages/wheel/bdist_wheel.py”,第 299 行,在运行 self.run_command('build') 文件“/usr/lib64 /python3.6/distutils/cmd.py”,第 313 行,在 run_command self.distribution.run_command(command) 文件“/usr/lib64/python3.6/distutils/dist.py”,第 974 行,在 run_command cmd_obj 中。 run() 文件“/usr/lib64/python3.6/distutils/command/build.py”,第 135 行,在运行 self.run_command(cmd_name) 文件“/usr/lib64/python3.6/distutils/cmd.py",第 313 行,在 run_command self.distribution.run_command(command) 文件 "/usr/lib64/python3.6/distutils/dist.py",第 974 行,在 run_command cmd_obj.run()文件“/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py”,第 134 行,运行 self.build_extension(ext) 文件“/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c71.pyff3,/setup”在 build_extension subprocess.check_call(cmake_setup, cwd=build_folder) 文件“/usr/lib64/python3.6/subprocess.py”中,第 311 行,在 check_call 中引发 CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake' , '/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/lib.linux-x86_64-3.6', '-DPYTHON_EXECUTABLE=/home/opc/py36env/bin/python3', '-DCMAKE_BUILD_TYPE'返回非零退出状态 1。
---------------------------------------- 错误:dlib 运行设置的构建轮失败。 py clean for dlib 无法构建 dlib 安装收集的包:dlib Running setup.py install for dlib ...错误错误:命令错误退出状态1:命令:/home/opc/py36env/bin/python3 -u -c '导入 io、os、sys、setuptools、tokenize;sys.argv[0] = '"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"'; file ='"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)( file )如果 os.path.exists(文件) 否则 io.StringIO('"'" '从设置工具导入设置;setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f .close();exec(编译(代码,文件,'"'"'exec'"'"'))' 安装 --record /tmp/pip-record-y0hkle0_/install-record.txt --single-version-externally-managed --compile --install- headers /home/opc/py36env/include/site/python3.6/dlib cwd: /tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/ 完整输出(58行):运行安装运行构建运行build_py包初始化文件'tools/python /dlib/初始化.py' 未找到(或不是常规文件)运行 build_ext 构建 Python 3.6.8 扩展(默认,2021 年 3 月 9 日,15:08:44) 调用 CMake 设置:'cmake /tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3 /tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/lib.linux-x86_64-3.6 -DPYTHON_EXECUTABLE=/home/opc/py36env/bin/python3 -DCMAKE_BUILD_TYPE=Release标识是 GNU 4.8.5 -- CXX 编译器标识未知 -- 检测 C 编译器 ABI 信息 -- 检测 C 编译器 ABI 信息 - 完成 -- 检查工作 C 编译器:/usr/bin/cc - 已跳过 -- 检测 C编译功能 - 检测 C 编译功能 - 在 CMakeLists.txt:14 (项目) 完成 CMake 错误:找不到 CMAKE_CXX_COMPILER。

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py",

第 261 行,在“主题 :: 软件开发”中,文件“/home/opc/py36env/lib64/python3.6/site-packages/setuptools/init/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/build/lib.linux-x86_64-3.6', '-DPYTHON_EXECUTABLE=/home/opc /py36env/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' 返回非零退出状态 1。 -------------- -------------- 错误:命令出错,退出状态为 1:/home/opc/py36env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"'; -DPYTHON_EXECUTABLE=/home/opc/py36env/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' 返回非零退出状态 1。-------- --------------------- 错误:命令出错,退出状态为 1:/home/opc/py36env/bin/python3 -u -c 'import io, os ,系统,设置工具,标记化;sys.argv[0] = '"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"'; -DPYTHON_EXECUTABLE=/home/opc/py36env/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' 返回非零退出状态 1。-------- --------------------- 错误:命令出错,退出状态为 1:/home/opc/py36env/bin/python3 -u -c 'import io, os ,系统,设置工具,标记化;sys.argv[0] = '"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"';file ='"'"'/tmp/pip-install-5zstrya1/dlib_5f4cec1247f74d1098b0e055d68c7ff3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)( file ) if os.path.exists( file ) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\ r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file , '"'"'exec'"'"')) ' 安装 --record /tmp/pip-record-y0hkle0_/install-record.txt --single-version-externally-managed --compile --install-headers /home/opc/py36env/include/site/python3.6/dlib 检查日志以获取完整的命令输出。

如果我尝试使用 pip3 install dlib 安装 dlib,也会发生同样的事情

标签: pythonlinuxcmakejupyter-notebook

解决方案


推荐阅读