python - 安装 Google Cloud SDK 时出错

标签 python macos python-2.7 google-app-engine google-cloud-platform

同时按照“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/

相关文章:

macos - 在 zsh 中安装 npm 后找不到命令

python - 将参数传递给 fsolve

Python 全局函数,如 'print'

python - 如何创建一个简单的梯度下降算法

macos - 如何使用 Facebook Pop 动画从中心缩放 NSView?

ruby - OSX Ruby Gems 添加到 ruby​​ 路径?

python - 找出列中最大的数字

python - 为什么不为实例属性调用 __get__ 方法?

python - 无法填充 QTableWidget

python - 具有管理功能的复制元素