我正在制作一个依赖于 spacy
的 Python 包。 Spacy 使用二进制语言模型。因此,我在 requirements.txt
https://github.com/explosion/spacy-models/releases/download/es_core_news_sm-2.0.0/es_core_news_sm-2.0.0.tar.gz#egg=spacy-english-model
但是,如果我卡住
环境,则包不会出现并带有下载 URL:
spacy-english-model==2.0.0
因此,如果我添加一个包,我无法pip install
它,然后pip freeze
。如何在 requirements.txt
中指定包,以便在 freeze
时显示其 URL?
最佳答案
您不需要使用pip freeze
来分发您的包。编写包时,您需要根据 documentation 在 requirements.txt
文件中添加模型。像这样:
https://github.com/explosion/spacy-models/releases/download/es_core_news_sm-2.0.0/es_core_news_sm-2.0.0.tar.gz
你可以看到发生了here (检查dev-requirements.txt
)
我不知道pip freeze
从哪里获取spacy-english-model
。我将从一个新的 python virtualenv 开始并再次测试所有内容。
关于python - Pip 安装二进制文件并保留requirements.txt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55525646/