嗨,我将python部署到lambda codestar时遇到错误
有人可以帮我吗?
[Container] 2019/07/11 21:15:54 Running command . venv/bin/activate
[Container] 2019/07/11 21:15:54 Running command python -m nltk.downloader wordnet
/usr/local/lib/python3.7/runpy.py:125: RuntimeWarning: 'nltk.downloader' found in sys.modules after import of package 'nltk', but prior to execution of 'nltk.downloader'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
[nltk_data] Error loading wordnet: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data] unable to get local issuer certificate (_ssl.c:1051)>
Error installing package. Retry? [n/y/e]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/codebuild/output/src147142456/src/venv/lib/python3.7/site-packages/nltk/downloader.py", line 2583, in <module>
halt_on_error=options.halt_on_error,
File "/codebuild/output/src147142456/src/venv/lib/python3.7/site-packages/nltk/downloader.py", line 798, in download
choice = input().strip()
EOFError: EOF when reading a line
答案 0 :(得分:0)
经过研究后,我不得不手动下载模块并将其保存到nltk_data中,然后在我的lambda中创建一个环境变量NLTK_DATA,其值为./nltk_data
检查此帖子中的最佳答案:
https://stackoverflow.com/questions/38916452/nltk-download-ssl-certificate-verify-failed
另一件事在下面的帖子中:
此命令启用https python -m nltk.downloader -u https://pastebin.com/raw/D3TBY4Mj all
https://github.com/nltk/nltk/issues/1787