【问题标题】:gcloud installation issues in cloudera VMcloudera VM中的gcloud安装问题
【发布时间】:2019-10-31 05:32:45
【问题描述】:

我正在尝试在 cloudera VM 中配置 gcloud sdk。下面是我用过的命令。我试图在 install.sh 中向 python 传递一个默认参数,但仍然没有成功。有人可以指导我任何干净的方法吗?

卷曲https://sdk.cloud.google.com |重击

1.我已经在现有的 2.6 之上安装了 python3.7

(base) [cloudera@quickstart google-cloud-sdk]$ which python
alias python='/home/cloudera/anaconda3/bin'
(base) [cloudera@quickstart google-cloud-sdk]$ whereis python 
python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.6-config /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
(base) [cloudera@quickstart google-cloud-sdk]$ 

2。来自 sh -x install.sh 的错误日志

+ _cloudsdk_which python2
+ which python2
+ CLOUDSDK_PYTHON=python2
+ unset PYTHONHOME
+ case :$CLOUDSDK_PYTHON_SITEPACKAGES:$VIRTUAL_ENV: in
+ case " $CLOUDSDK_PYTHON_ARGS " in
+ CLOUDSDK_PYTHON_ARGS=-S
+ unset CLOUDSDK_PYTHON_SITEPACKAGES
+ export CLOUDSDK_ROOT_DIR CLOUDSDK_PYTHON_ARGS
+ '[' -z python2 ']'
++ id -u
+ '[' 501 = 0 ']'
+ python2 -S /home/cloudera/google-cloud-sdk/bin/bootstrapping/install.py
Traceback (most recent call last):
  File "/home/cloudera/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
    import bootstrapping
  File "/home/cloudera/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
    import setup  # pylint:disable=g-import-not-at-top
  File "/home/cloudera/google-cloud-sdk/bin/bootstrapping/setup.py", line 55, in <module>
    from googlecloudsdk.core import properties
  File "/home/cloudera/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 378
    self.__sections = {section.name: section for section in sections}
                                               ^

3.默认情况下对 python 进行硬编码后。

+ echo Welcome to the Google Cloud 'SDK!'
Welcome to the Google Cloud SDK!
++ _cloudsdk_root_dir install.sh
++ case $1 in
+++ _cloudsdk_which install.sh
+++ which install.sh
+++ command -v install.sh
++ _cloudsdk_path=
++ case $_cloudsdk_path in
++ _cloudsdk_path=/home/cloudera/google-cloud-sdk/
++ _cloudsdk_dir=0
++ :
+++ readlink /home/cloudera/google-cloud-sdk/
++ _cloudsdk_link=
++ case $_cloudsdk_dir in
++ '[' -d /home/cloudera/google-cloud-sdk/ ']'
++ break
++ :
++ case $_cloudsdk_path in
+++ dirname /home/cloudera/google-cloud-sdk//.
++ _cloudsdk_path=/home/cloudera/google-cloud-sdk
++ :
++ case $_cloudsdk_path in
++ echo /home/cloudera/google-cloud-sdk
++ break
+ CLOUDSDK_ROOT_DIR=/home/cloudera/google-cloud-sdk
+ '[' -z '' ']'
+ CLOUDSDK_PYTHON=python
+ unset PYTHONHOME
+ case :$CLOUDSDK_PYTHON_SITEPACKAGES:$VIRTUAL_ENV: in
+ case " $CLOUDSDK_PYTHON_ARGS " in
+ CLOUDSDK_PYTHON_ARGS=-S
+ unset CLOUDSDK_PYTHON_SITEPACKAGES
+ export CLOUDSDK_ROOT_DIR CLOUDSDK_PYTHON_ARGS
+ '[' -z python ']'
++ id -u
+ '[' 501 = 0 ']'
+ python -S /home/cloudera/google-cloud-sdk/bin/bootstrapping/install.py
Traceback (most recent call last):
  File "/home/cloudera/google-cloud-sdk/bin/bootstrapping/install.py", line 27, in <module>
    from googlecloudsdk import gcloud_main
  File "/home/cloudera/google-cloud-sdk/lib/googlecloudsdk/gcloud_main.py", line 37, in <module>
    from googlecloudsdk.command_lib.util.apis import yaml_command_translator
  File "/home/cloudera/google-cloud-sdk/lib/googlecloudsdk/command_lib/util/apis/yaml_command_translator.py", line 241
    if self.spec.async:
                     ^
SyntaxError: invalid syntax

【问题讨论】:

    标签: cloudera gcloud gsutil


    【解决方案1】:

    Gcloud SDK 适用于 2.7 或更高版本,但不适用于 python3。我必须按照我执行的步骤安装 2.7 及以下版本。

    1. Get python2.7 for anaconda
    2. Install and provide an alernative path like /home/cloudera/anaconda2/
    3. bash Anaconda2-2019.03-Linux-x86_64.sh
    4. Update .bash_profile (alias python2.7='/home/cloudera/anaconda2/bin/python2.7')
    5. Update CLOUDSDK_PYTHON="python2.7" in /home/cloudera/google-cloud-sdk/install.sh (Need to put after the if loop)
    6. Then execute sh -x install.sh
    

    谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多