我正在尝试使用 Cloud Build 为要使用 GCloud Run 运行的 Python 脚本构建容器映像。当我使用命令 gcloud builds submit --tag gcr.io/*project id*/*pythonfunction*
时,它会一直构建,直到它尝试运行 pip install opencv-python numpy dlib google-cloud-storage
。根据构建的日志,似乎是 dlib 在使用 cmake 安装时导致崩溃。下面是安装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: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s8fhib1_/dlib_60d45ceada19422b9232c522a3893f93/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s8fhib1_/dlib_60d45ceada19422b9232c522a3893f93/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'"'"'))' install --record /tmp/pip-record-4jnsusb_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/dlib
cwd: /tmp/pip-install-s8fhib1_/dlib_60d45ceada19422b9232c522a3893f93/
Complete output (45 lines):
running install
running build
running build_py
package init file 'tools/python/dlib/__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.9.5 (default, May 12 2021, 15:36:59)
Invoking CMake setup: 'cmake /tmp/pip-install-s8fhib1_/dlib_60d45ceada19422b9232c522a3893f93/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-s8fhib1_/dlib_60d45ceada19422b9232c522a3893f93/build/lib.linux-x86_64-3.9 -DPYTHON_EXECUTABLE=/usr/local/bin/python -DCMAKE_BUILD_TYPE=Release'
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
如果有人能弄清楚“Unix Makefiles”的错误是什么意思,那将不胜感激。谢谢!