同时按照“Mac OS X”的安装步骤Installation and Quick Start
我使用了以下命令:-
curl https://sdk.cloud.google.com | bash
和/Users/xxxxx/google-cloud-sdk/
下的目录提取
但是我得到了这个错误:-
Traceback (most recent call last):
File "/Users/xxxxx/google-cloud-sdk/bin/bootstrapping/install.py", line 8, in <module>
import bootstrapping
File "/Users/xxxxx/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 9, in <module>
import setup
File "/Users/xxxxx/google-cloud-sdk/bin/bootstrapping/setup.py", line 44, in <module>
from googlecloudsdk.core.util import platforms
File "/Users/xxxxx/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/util/platforms.py", line 6, in <module>
import platform
ImportError: No module named platform
环境:-
- Mac OS X 优胜美地 10.10
- python 2.7.6
- $ whereis python
/usr/bin/python
有人可以帮忙吗?
最佳答案
我发现了标准模块的不同位置,例如:-
>>> import platform >>> platform.__file__
=>'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform .pyc'
>>> import os >>> os.__file__
=> 在我的配置文件中的某处/Users/xxxxx/Library/Frameworks/Python.framework/...
,
所以,我已经通过以下步骤解决了这个问题:-
- 删除了
/Users/xxxxx/Library/Frameworks/Python.framework/
。 - 通过
brew
重新安装了 python,以远离 Apple python。
然后,Google Cloud SDK 顺利安装并正常运行。
标准模块的新位置是/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
关于python - 安装 Google Cloud SDK 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30034768/