直接从Conda Environment.yml安装Spacy语言模型

发布于 2025-02-04 15:54:10 字数 309 浏览 4 评论 0原文

为了促进我构建的工具的安装,我想拥有一个enviroment.yml文件,该文件可以帮助安装所有所需的依赖项。但是,我确实有一个spacy语言模型需要通过(例如)python -m spacy下载en_core_web_sm

我的问题是,我想从一个简单的enda env create -f Environment.yml下载此模型。我知道可以通过conda安装PIP软件包,但不知道如何在Environment.yml文件中执行“下载”。在此先感谢您提供的任何帮助。

In hopes of facilitating the installation of a tool I have built, I would like to have an enviroment.yml file that could help install all the required dependencies. I do have one, however, Spacy language models require an additional download via (for example) python -m spacy download en_core_web_sm.

My issue is that I would like to have this model downloaded from a simple conda env create -f environment.yml. I know that pip packages can be installed via Conda, but do not know how to perform the "download" inside the environment.yml file. Thanks in advance for any help you can provide.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铃予 2025-02-11 15:54:10

spacy文档

下载最佳实践
下载命令主要是作为方便的,交互式包装器 - 执行兼容性检查并打印详细消息,以防万一出现问题。 不建议使用此命令作为自动过程的一部分。如果您知道项目需要哪个包,则应考虑通过pip ,或将软件包上传到本地PYPI安装并直接从那里获取。这还可以使您可以将其添加为版本的软件包依赖关系。


虽然可以在conda环境中包括PYPI依赖项,但Conda Forge还通过 spacy-models-feedstock 。在OP的示例中,这意味着添加软件包spacy-model-en_core_web_sm

As the Spacy documentation of download command states:

DOWNLOADING BEST PRACTICES
The download command is mostly intended as a convenient, interactive wrapper – it performs compatibility checks and prints detailed messages in case things go wrong. It’s not recommended to use this command as part of an automated process. If you know which package your project needs, you should consider a direct download via pip, or uploading the package to a local PyPI installation and fetching it straight from there. This will also allow you to add it as a versioned package dependency to your project.

While it is possible to include PyPI dependencies in a Conda environment YAML, Conda Forge also publishes Spacy models as packages via the spacy-models-feedstock. In the example from OP, this would mean adding the package spacy-model-en_core_web_sm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文