gpt4 book ai didi

python - 如何将 python 模块加载到 codestar 中

转载 作者:太空宇宙 更新时间:2023-11-03 20:38:40 28 4
gpt4 key购买 nike

您好,我在将 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

最佳答案

经过一些研究,我必须手动下载模块并将它们保存到 nltk_data 中,然后在我的 lambda 中,我创建了一个环境变量 $NLTK_DATA ,其值为 ./nltk_data

查看 this post 中的最佳答案

另一件事在下面的帖子中:

This command enables HTTPS:

python -m nltk.downloader -u https://pastebin.com/raw/D3TBY4Mj all

https://github.com/nltk/nltk/issues/1787

关于python - 如何将 python 模块加载到 codestar 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56997648/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com