在Heroku应用程序上安装spacy en_core_web_lg时出错

2024-10-03 09:13:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用Django在Heroku上部署我的ML模型,我的应用程序需要en_core_web_lg,但无法安装它

My requirements.txt类似于:

..
..
djangorestframework==3.12.2
en-core-web-lg==2.3.1
en-core-web-sm==2.3.1
gunicorn==20.0.4
heroku==0.1.4
..

错误是:

 ERROR: Could not find a version that satisfies the requirement en-core-web-lg==2.3.1 (from -r /tmp/build_c3075f3c_/requirements.txt (line 14)) (from versions: none)
       ERROR: No matching distribution found for en-core-web-lg==2.3.1 (from -r /tmp/build_c3075f3c_/requirements.txt (line 14))
 !     Push rejected, failed to compile Python app.
 !     Push failed


Tags: djangofromcorebuildtxtweblineerror
1条回答
网友
1楼 · 发布于 2024-10-03 09:13:37

我不知道为什么它不是从directrequirements.txt文件安装的。 但还有另一种方法,但这是不对的,但工作将继续下去。 首先,您必须从即将发生错误的requirements.txt文件中删除包。 然后将应用程序推到Heroku,一旦应用程序到达Heroku,然后从terminalHeroku{}编写此代码

如果使用terminal,则:

heroku run bash

比跑

pip install spacy

然后从spacy安装所需的软件

python -m spacy download en_core_web_lg

如果使用Heroku dashboard,则: 首先进入你的Heroku dashboard点击你的应用程序,然后在顶部右键点击More并选择Run Console 示例图像 enter image description here 然后这个接口就会出现 enter image description here 在这种情况下,您必须单击bash或键入bash并运行 在此之后,您可以放置相同的凸轮并安装。 我希望你能用这种方式解决你的问题。(:

相关问题 更多 >