【发布时间】:2015-01-15 03:46:11
【问题描述】:
我正在尝试使用 MacPorts 安装 Google App Engine Python SDK。
我安装了 Python 2.7(使用 MacPorts),并且刚刚安装了 GAE SDK:
sudo port install py-googleappengine
似乎安装正确。然而,当我运行 Python 时,
Python 2.7.9 (default, Dec 13 2014, 15:13:49)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import google.appengine.api
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named appengine.api
我已验证所使用的 Python 是来自 MacPorts 的 Python,而不是 Apple 的 Python:
$ which python
/opt/local/bin/python
我发现文件 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/googleappengine.pth 包含
/opt/local/share/google_appengine
也存在。
我不确定为什么无法导入库。有什么想法吗?
更新:问题是与“google/protobuf/”存在冲突,它使用相同的命名空间并遮盖了新的 google 命名空间(sigh,我想命名空间是为了避免这种情况......);当我删除包含 protobuf 的“google”文件夹并尝试导入 google 时,它什么都不包含。我不确定我在清理过程中遗漏了什么文件。
【问题讨论】:
标签: google-app-engine python-2.7 macports