Can't install gcloud on Amazon Linux : invalid syntax

江枫思渺然 提交于 2019-11-28 12:20:55

问题


I'm trying to install gcloud on my EC2 server running Amazon Linux 4.14.47-56.37 64bits, in interactive mode running the following command :

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

The files download correctly, but the install then fails with the following Traceback :

  File "/home/ec2-user/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
    import bootstrapping
  File "/home/ec2-user/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
    import setup  # pylint:disable=g-import-not-at-top
  File "/home/ec2-user/google-cloud-sdk/bin/bootstrapping/setup.py", line 55, in <module>
    from googlecloudsdk.core import properties
  File "/home/ec2-user/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 291
    self.__sections = {section.name: section for section in sections}
                                               ^
SyntaxError: invalid syntax

Any idea why this for is causing issues?

I am running python 2.7 (2.7.14) as recommended by Google.


回答1:


On top of python 2.7 installed on the "python" command, I also had python 2.6 installed on the "python2" command. Uninstalling python 2.6 solved the issue, Google Cloud install went through without issue on the next try.




回答2:


You locally update the install.sh file to use python2.7 instead of python2. This worked for me




回答3:


Setup yum repo:

# Update YUM with Cloud SDK repo information:
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM
# The indentation for the 2nd line of gpgkey is important.

Install yum downloader and download the rpm, then install with "--nodeps":

yum install yum-utils
yumdownloader google-cloud-sdk-231.0.0-1.el7.noarch
mv 23873bd6e8459ba6e70e96eb8f03f6ac03cd707ce3c80baa8264c714e030c915-google-cloud-sdk-231.0.0-1.el7.noarch.rpm /usr/local/src/google-cloud-sdk-231.0.0-1.el7.noarch
rpm -ivh --nodeps /usr/local/src/google-cloud-sdk-231.0.0-1.el7.noarch


来源:https://stackoverflow.com/questions/50992705/cant-install-gcloud-on-amazon-linux-invalid-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!