2

我目前正在尝试在我的 macbook 上安装 google cloud sdk。我正在使用 scikit-learn 和 anaconda 进行机器学习,所以我的笔记本电脑上的 python 指向 python3.5。但是 google cloud sdk 需要 python 2.7 才能安装,这就是为什么我面临无法安装它的问题。

当我运行 install.sh 文件时发生了错误,我不知道如何处理它:

Adam | ~ $ git/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
  File "/Users/AdamLiu/Git/google-cloud-sdk/lib/third_party/enum/__init__.py", line 364, in __getattr__
    return cls._member_map_[name]
KeyError: '_convert'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/AdamLiu/git/google-cloud-sdk/bin/bootstrapping/install.py", line 8, in <module>
    import bootstrapping
  File "/Users/AdamLiu/Git/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 9, in <module>
    import setup
  File "/Users/AdamLiu/Git/google-cloud-sdk/bin/bootstrapping/setup.py", line 34, in <module>
    from googlecloudsdk.core.util import platforms
  File "/Users/AdamLiu/Git/google-cloud-sdk/lib/googlecloudsdk/core/util/platforms.py", line 18, in <module>
    import platform
  File "/Users/AdamLiu/anaconda/lib/python3.5/platform.py", line 117, in <module>
    import sys, os, re, subprocess
  File "/Users/AdamLiu/anaconda/lib/python3.5/subprocess.py", line 364, in <module>
    import signal
  File "/Users/AdamLiu/anaconda/lib/python3.5/signal.py", line 8, in <module>
    _IntEnum._convert(
  File "/Users/AdamLiu/Git/google-cloud-sdk/lib/third_party/enum/__init__.py", line 366, in __getattr__
    raise AttributeError(name)
AttributeError: _convert

超级感谢提前!

4

1 回答 1

9

在运行install.sh之前,将 CLOUDSDK_PYTHON 环境变量设置为 Python 2.x 可执行文件的位置。

或者确保你的路径中有 python2 以便which python2可以找到它。

于 2016-05-24T18:09:05.437 回答