我在为AWS制作和使用python部署包时遇到了问题,该包使用package。这就是我所犯的错误。
No module named ndg.httpsclient.ssl_peer_verification: ImportError
Traceback (most recent call last):
File "/var/task/Lambda.py", line 3, in pusherTest
pusher = Pusher(app_id=u'154504', key=u'121300e92c61a1fe43bc', secret=u'bfff467a2b6551f19226')
File "/var/task/pusher/pusher.py", line 42, in __init__
from pusher.requests import RequestsBackend
File "/var/task/pusher/requests.py", line 12, in <module>
import urllib3.contrib.pyopenssl
File "/var/task/urllib3/contrib/pyopenssl.py", line 49, in <module>
from ndg.httpsclient.ssl_peer_verification import SUBJ_ALT_NAME_SUPPORT
ImportError: No module named ndg.httpsclient.ssl_peer_verification以下是为任何想尝试的人重新创建我的问题的步骤。我甚至在免费沙箱中包括了一个虚拟的Pusher应用程序,以防你从未使用过它。
virtualenv创建新的虚拟环境
迷走@home:~/Code/Lamdba$ virtualenv env新python可执行文件在/home/迷走语/Code/Lamdba/env/bin/python中安装setuptools、pip、wheel...done。pip install pusher
env/lib/python2.7/site-packages压缩到具有如下代码的py脚本的Zip文件中
from pusher import Pusher def pusherTest(context, event): pusher = Pusher(app_id=u'154504', key=u'121300e92c61a1fe43bc', secret=u'bfff467a2b6551f19226') pusher.trigger('testchannel', 'testevent', {u'some': u'data'})拜托有人帮忙。
发布于 2016-03-31 17:49:34
您的应用程序无法导入ndg.httpsclient.ssl_peer_verification模块,因此您必须确保:
ndg-httpsclient包已安装在虚拟环境中。它是pusher包的依赖项,所以我想它确实已经安装好了,但是请用pip freeze确认一下。env/lib/python2.7/site-packages/的内容,而不是目录。AWS期望ndg包位于Lambda应用程序的根目录中。https://stackoverflow.com/questions/36338846
复制相似问题