你如何使用pycrypto和GAP?pycrypto和Google应用引擎
它说here它不支持最新版本。这是否意味着我必须使用他们指出的版本?
我试过,但,当我执行setup.py
我得到的错误src/MD2.c:15:20: fatal error: Python.h: No such file or directory compilation terminated.
error: command 'gcc' failed with exit status 1
你如何使用pycrypto和GAP?pycrypto和Google应用引擎
它说here它不支持最新版本。这是否意味着我必须使用他们指出的版本?
我试过,但,当我执行setup.py
我得到的错误src/MD2.c:15:20: fatal error: Python.h: No such file or directory compilation terminated.
error: command 'gcc' failed with exit status 1
几个小时前发布的App Engine 1.7.2现在支持最新版本的PyCrypto 2.6。链接的文档很可能已过时,并会很快更新。你可以使用instructing app engine to include it。
GAP不会让你使用完整版本pycrypto的,因为它有很多的C,所以你不能部署,他们将有把它削减到他们可以允许的程度。您必须使用from google.appengine.dist import use_library
,然后使用use_library('lib', 'version.')
。希望这有些帮助。
为了GAE使用pycrypto,您必须将以下添加到您的app.yaml文件:
libraries:
- name: pycrypto
version: "2.6"
就像一个魅力,code like
from Crypto.Cipher import AES
from Crypto import Random
class MainPage(webapp2.RequestHandler):
def get(self) :
self.response.headers['Content-Type'] = 'text/plain'
key = b'Sixteen byte key'
iv = Random.new().read(AES.block_size)
cipher = AES.new(key, AES.MODE_CFB, iv)
msg = iv + cipher.encrypt(b'Attack at dawn')
self.response.write(msg)
应该像一个魅力(实际上触发器一个下载!)
This information about what versions of what libraries are available are included here
大概你shoul d使用正确的标签谷歌应用程序引擎,而不是谷歌应用程序脚本得到答案? – Taifun