python - 在heroku上安装nltk包时出错
问题描述
我正在尝试使用 nltk.txt 文件在 heroku 中安装 nltk 包。在我的 nltk.txt 文件中只写入了 punkt。在 requirements.txt 文件中写入了 nltk。但是当推动它时,它会显示错误。请帮助解决我的问题
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.6.7
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing requirements with pip
remote:
remote: -----> Downloading NLTK corpora…
remote: -----> Downloading NLTK packages: tokenize
remote: /app/.heroku/python/lib/python3.6/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
remote: warn(RuntimeWarning(msg))
remote: Traceback (most recent call last):
remote: [nltk_data] Error loading tokenize : Package 'tokenize ' not found in
remote: File "/app/.heroku/python/lib/python3.6/runpy.py", line 193, in _run_module_as_main
remote: [nltk_data] index
remote: "__main__", mod_spec)
remote: File "/app/.heroku/python/lib/python3.6/runpy.py", line 85, in _run_code
remote: exec(code, run_globals)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/nltk/downloader.py", line 2272, in <module>
remote: Error installing package. Retry? [n/y/e]
remote: halt_on_error=options.halt_on_error)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/nltk/downloader.py", line 681, in download
remote: choice = input().strip()
remote: EOFError: EOF when reading a line
remote: -----> Running post-compile hook
remote: -----> Running install_nltk_data
remote: -----> Starting nltk data installation
remote: /app/.heroku/python/lib/python3.6/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
remote: warn(RuntimeWarning(msg))
remote: [nltk_data] Downloading package punkt to /app/nltk_data...
remote: [nltk_data] Unzipping tokenizers/punkt.zip.
remote: bin/install_nltk_data: line 21: cd: '/app/nltk_data': No such file or directory
remote: -----> Finished nltk data installation
remote: -----> Post-compile done
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 49M
remote: -----> Launching...
remote: Released v19
remote: https://mysterious-coast-63128.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/mysterious-coast-63128.git
7b1a415..9b14971 master -
解决方案
推荐阅读
- rest - 这是一个符合使用标头而不是 JSON-body 来传递数据的 REST API 吗?
- python - Python - 无法使用 selenium webdriver 使用谷歌帐户登录任何网站
- android - 我可以拥有一个使用真实 SIM 卡的 Android 模拟器吗?
- class - UML类图中两个类可以分配给一个枚举器吗
- python - 杀死进程不要杀死子进程并且不要关闭终端窗口
- python - 使用 lambda 了解 pandas 中的分配行为
- python - 如果条件使用 sympy 方程求解器/sympy 非常慢
- jekyll - 如何配置 Jekyll 让 /blog 并排放置帖子和静态页面
- javascript - 事件侦听器因函数而未触发
- php - Laravel 查询将分组小时的所有 X 和 Y 列相加