4

我正在尝试使用 测试 Google App Engine 应用程序dev_appserver.py,但是当我运行时,我import CryptoIOError(即无访问权限)回溯中摘录了以下内容:

...
import Crypto
...
File "/System/Library/Frameworks/Python.framework/Versions
      /2.7/lib/python2.7/zipfile.py", line 867, in read
    return self.open(name, "r", pwd).read()
  File "/System/Library/Frameworks/Python.framework/Versions
        /2.7/lib/python2.7/zipfile.py", line 882, in open
    zef_file = open(self.filename, 'rb')
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
       GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google
       /appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
    raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages
                                    /pycrypto-2.3-py2.7-macosx-10.7-intel.egg'

我在 Mac OS X 10.7 上,使用 Python 2.7 和 Google App Engine 1.6.6。

由于Google App Engine 支持PyCrypto ,我希望它可以在开发服务器上运行。

我知道这会dev_appserver.py阻止加载外部文件。但是,我注意到appengine/tools/dev_appserver_import_hook.py白名单中似乎包含所有必需的文件(例如_fastmath)。

注意,在app.yaml我有

libraries: 
- name: pycrypto
  version: latest

似乎我遗漏了一些明显但至关重要的东西。任何想法将不胜感激。


编辑有关更多详细信息,请参阅:https ://code.google.com/p/googleappengine/issues/detail?id=12129

4

2 回答 2

1

是的,您必须自己安装第三方库。谷歌准确地解释了他们平台上提供的版本,所以这应该不是问题。

于 2012-07-01T09:46:42.917 回答
0

解决这个问题的最好方法是创建一个虚拟环境并在其中安装 pycrypto。未检测到您的库的原因app.yaml很可能是因为您的机器中安装了多个版本的 python,并且您用于运行程序的版本可能与您安装库的版本不同

于 2017-08-05T15:24:46.417 回答