通过pip安装的Google Cloud SDK:“ gsutil需要python 2.7”

时间:2018-07-23 01:07:59

标签: gsutil google-cloud-sdk

我正在尝试在Macbook Pro上安装Google Cloud SDK。如果我尝试按照https://cloud.google.com/storage/docs/gsutil_install下载并运行bash脚本,

curl https://sdk.cloud.google.com | bash

我收到以下错误:

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
ERROR: (gcloud.components.update) The component [gcloud-deps-darwin-x86_64] failed to download.

或者,如果我尝试使用sudo pip install gsutil使用它进行安装,然后尝试运行它,则会出现以下错误:

Kurts-MacBook-Pro:peek-solutions2 kurtpeek$ gsutil --help
gsutil requires python 2.7.

使用pyenv将Python版本设置为2.7后,仍然出现此错误:

Kurts-MacBook-Pro:peek-solutions2 kurtpeek$ pyenv versions
  system
* 2.7 (set by PYENV_VERSION environment variable)
  3.6.5

如何安装gsutil的工作版本?

1 个答案:

答案 0 :(得分:2)

https://datatables.net/reference/api/draw()之后,我下载了.tar.gz文件并运行./google-cloud-sdk/install.sh,现在它可以正常工作了:

Kurts-MacBook-Pro:~ kurtpeek$ gsutil --help
Usage: gsutil [-D] [-DD] [-h header]... [-m] [-o] [-q] [command [opts...] args...]
Available commands:
  acl             Get, set, or change bucket and/or object ACLs
  cat             Concatenate object content to stdout
  compose         Concatenate a sequence of objects into a new composite object.
  config          Obtain credentials and create configuration file
  cors            Get or set a CORS JSON document for one or more buckets
  cp              Copy files and objects
  defacl          Get, set, or change default ACL on buckets
  defstorageclass Get or set the default storage class on buckets
  du              Display object size usage
  hash            Calculate file hashes
  help            Get help about commands and topics
  iam             Get, set, or change bucket and/or object IAM permissions.
  kms             Configure Cloud KMS encryption
  label           Get, set, or change the label configuration of a bucket.
  lifecycle       Get or set lifecycle configuration for a bucket
  logging         Configure or retrieve logging on buckets
  ls              List providers, buckets, or objects
  mb              Make buckets
  mv              Move/rename objects and/or subdirectories
  notification    Configure object change notification
  perfdiag        Run performance diagnostic
  rb              Remove buckets
  requesterpays   Enable or disable requester pays for one or more buckets
  rewrite         Rewrite objects
  rm              Remove objects
  rsync           Synchronize content of two buckets/directories
  setmeta         Set metadata on already uploaded objects
  signurl         Create a signed url
  stat            Display object status
  test            Run gsutil unit/integration tests (for developers)
  update          Update to the latest gsutil release
  version         Print version info about gsutil
  versioning      Enable or suspend versioning for one or more buckets
  web             Set a main page and/or error page for one or more buckets

Additional help topics:
  acls            Working With Access Control Lists
  anon            Accessing Public Data Without Credentials
  apis            Cloud Storage APIs
  crc32c          CRC32C and Installing crcmod
  creds           Credential Types Supporting Various Use Cases
  dev             Contributing Code to gsutil
  encoding        Filename encoding and interoperability problems
  encryption      Using Encryption Keys
  metadata        Working With Object Metadata
  naming          Object and Bucket Naming
  options         Top-Level Command-Line Options
  prod            Scripting Production Transfers
  projects        Working With Projects
  retries         Retry Handling Strategy
  security        Security and Privacy Considerations
  subdirs         How Subdirectories Work
  support         Google Cloud Storage Support
  throttling      Throttling gsutil
  versions        Object Versioning and Concurrency Control
  wildcards       Wildcard Names

Use gsutil help <command or topic> for detailed help.