当python指向python3时,谷歌云sdk不工作 [英] Google cloud sdk not working when python points python3

查看:348
本文介绍了当python指向python3时,谷歌云sdk不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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

  Adam | 〜$ git / google-cloud-sdk / install.sh 
欢迎使用Google Cloud SDK!
Traceback(最近一次调用最后一次):
在__getattr__ $ b $文件/Users/AdamLiu/Git/google-cloud-sdk/lib/third_party/enum/__init__.py,第364行b返回cls._member_map_ [name]
KeyError:'_convert'

在处理上述异常期间,发生了另一个异常:

Traceback(最近一次调用last ):
文件/Users/AdamLiu/git/google-cloud-sdk/bin/bootstrapping/install.py,第8行,位于< module>
导入bootstrapping
文件/Users/AdamLiu/Git/google-cloud-sdk/bin/bootstrapping/bootstrapping.py,第9行,位于< module>
导入设置
文件/Users/AdamLiu/Git/google-cloud-sdk/bin/bootstrapping/setup.py,第34行,位于< module>
来自googlecloudsdk.core.util导入平台
文件/Users/AdamLiu/Git/google-cloud-sdk/lib/googlecloudsdk/core/util/platforms.py,第18行,在<模块>
导入平台
文件/Users/AdamLiu/anaconda/lib/python3.5/platform.py,第117行,位于< module>
import sys,os,re,subprocess
在< module>文件中的/Users/AdamLiu/anaconda/lib/python3.5/subprocess.py,第364行。
导入信号
文件/Users/AdamLiu/anaconda/lib/python3.5/signal.py,第8行,位于< module>
_IntEnum._convert(
文件/Users/AdamLiu/Git/google-cloud-sdk/lib/third_party/enum/__init__.py,第366行,在__getattr__
中引发AttributeError(名称)
AttributeError:_convert

超级感谢提前!在运行 google-cloud-sdk / blob / master / install.sh> install.sh



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


I am currently trying to install google cloud sdk on my macbook. I am using scikit-learn and anaconda for machine learning so on my laptop python points to python3.5. However google cloud sdk requires python 2.7 for installation, and that's why I am facing the problem of not be able to install it.

when I ran the install.sh file the error occurred and I have no clue how to deal with it:

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

Super thanks in advance!

解决方案

Set the CLOUDSDK_PYTHON environment variable to the location of your Python 2.x executable before running install.sh.

Or make sure that you have python2 in your path so that which python2 can find it.

这篇关于当python指向python3时,谷歌云sdk不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆