如何在 Google 云平台中安装 cmake

how to install cmake in Google Cloud Platform

我正在尝试部署使用 dlib 库的 django 项目,但在部署时,Google 控制台抛出一个错误,提示需要 CMake 才能安装 dlib。这些都在我的系统中,但如何让它们在 Google 云中工作?如何在 Google Cloud 中安装 cmake? requirements.txt.

中提到了我所有的包裹

Google 控制台:

Step #1 - "builder": RuntimeError:
Step #1 - "builder": *******************************************************************
Step #1 - "builder": CMake must be installed to build the following extensions: dlib
Step #1 - "builder": *******************************************************************
Step #1 - "builder":
Step #1 - "builder":
Step #1 - "builder": ----------------------------------------
Step #1 - "builder": Running setup.py clean for dlib
Step #1 - "builder": Building wheel for face-recognition-models (setup.py): started
Step #1 - "builder": Building wheel for face-recognition-models (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for gast (setup.py): started
Step #1 - "builder": Building wheel for gast (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for gif2numpy (setup.py): started
Step #1 - "builder": Building wheel for gif2numpy (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for hashids (setup.py): started
Step #1 - "builder": Building wheel for hashids (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for imutils (setup.py): started
Step #1 - "builder": Building wheel for imutils (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for kaitaistruct (setup.py): started
Step #1 - "builder": Building wheel for kaitaistruct (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for numpy2gif (setup.py): started
Step #1 - "builder": Building wheel for numpy2gif (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for opt-einsum (setup.py): started
Step #1 - "builder": Building wheel for opt-einsum (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for PILasOPENCV (setup.py): started
Step #1 - "builder": Building wheel for PILasOPENCV (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for PyYAML (setup.py): started
Step #1 - "builder": Building wheel for PyYAML (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for termcolor (setup.py): started
Step #1 - "builder": Building wheel for termcolor (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Building wheel for wrapt (setup.py): started
Step #1 - "builder": Building wheel for wrapt (setup.py): finished with status 'done'
Step #1 - "builder": Stored in directory: /tmp/tmpfuPQRa/wheel
Step #1 - "builder": Successfully built absl-py face-recognition-models gast gif2numpy hashids imutils kaitaistruct numpy2gif opt-einsum PILasOPENCV PyYAML termcolor wrapt
Step #1 - "builder": Failed to build dlib
Step #1 - "builder":
Step #1 - "builder": INFO `pip_download_wheels` had stderr output:
Step #1 - "builder": Failed building wheel for dlib
Step #1 - "builder": ERROR: Failed to build one or more wheels
Step #1 - "builder":
Step #1 - "builder": ERROR error: `pip_download_wheels` returned code: 1
Step #1 - "builder": INFO pip_download_wheels took 114 seconds
Step #1 - "builder": INFO build process for FTL image took 119 seconds
Step #1 - "builder": INFO full build took 119 seconds
Step #1 - "builder": ERROR `pip_download_wheels` had stderr output:
Step #1 - "builder": Failed building wheel for dlib
Step #1 - "builder": ERROR: Failed to build one or more wheels
Step #1 - "builder":
Step #1 - "builder": error: `pip_download_wheels` returned code: 1
Step #1 - "builder": Traceback (most recent call last):
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder": "__main__", fname, loader, pkg_name)
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder": exec code in run_globals
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 57, in main
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/common/ftl_error.py", line 58, in UserErrorHandler
Step #1 - "builder": IOError: [Errno 2] No such file or directory: '""/output'
Finished Step #1 - "builder"

您可以将 cmake 安装为

  1. 如果您使用的是 CentOS
sudo yum install -y cmake
  1. Debian/Ubuntu 基于操作系统
sudo apt update
sudo apt-get install -y cmake

或者您可以安装 build-essential 包

sudo apt-get install -y build-essential

希望对您有所帮助