[英]Problem installing package using setup.py
I have setup.py set to get the dependencies from requirements.txt that I generate from my virtual environment of the project.我已将 setup.py 设置为从我从项目的虚拟环境生成的 requirements.txt 中获取依赖项。 As follows:如下:
In my venv:在我的 venv 中:
pip3 freeze > requirements.txt
Then:然后:
with open('requirements.txt') as f:
required = f.read().splitlines()
setuptools.setup(
...
install_requires=required,
...
)
But I have this error displayed when I try to install my package:但是当我尝试安装我的软件包时显示此错误:
raise RequirementParseError(str(e))
pip._vendor.pkg_resources.RequirementParseError: Parse error at "'(===file'": Expected stringEnd
So when checking my requirements.txt file, I found this which must be the root cause of package installation failure:所以在检查我的requirements.txt文件时,我发现这一定是包安装失败的根本原因:
avro-python3===file-.avro-VERSION.txt
I didn't install it explicitly it is a transitive dependency.我没有明确安装它,它是一个传递依赖。 And when I try to install avro-python3 it, I get the following error:当我尝试安装 avro-python3 时,出现以下错误:
Requirement already satisfied: avro-python3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (file-.avro-VERSION.txt)
What can I do to fix my problem?我能做些什么来解决我的问题?
Thank you.谢谢你。
This error happens because the setup
method is not expecting a version to have the format file-.avro-VERSION.txt
.发生此错误是因为setup
方法不希望版本具有file-.avro-VERSION.txt
格式。 I suspect that the character "-" is what bothers the parser, as it expects the string to end instead of that character.我怀疑字符“-”是解析器的困扰,因为它期望字符串结束而不是该字符。
I suggest you try to use one of the official versions on the requirements.txt
file and the problem should be gone.我建议您尝试使用requirements.txt
文件上的官方版本之一,问题应该消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.