簡體   English   中英

使用 setup.py 安裝包時出現問題

[英]Problem installing package using setup.py

我已將 setup.py 設置為從我從項目的虛擬環境生成的 requirements.txt 中獲取依賴項。 如下:

在我的 venv 中:

pip3 freeze > requirements.txt

然后:

with open('requirements.txt') as f:
    required = f.read().splitlines()

setuptools.setup(
    ...
    install_requires=required,
    ...
)

但是當我嘗試安裝我的軟件包時顯示此錯誤:

raise RequirementParseError(str(e))
pip._vendor.pkg_resources.RequirementParseError: Parse error at "'(===file'": Expected stringEnd

所以在檢查我的requirements.txt文件時,我發現這一定是包安裝失敗的根本原因:

avro-python3===file-.avro-VERSION.txt

我沒有明確安裝它,它是一個傳遞依賴。 當我嘗試安裝 avro-python3 時,出現以下錯誤:

Requirement already satisfied: avro-python3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (file-.avro-VERSION.txt)

我能做些什么來解決我的問題?

謝謝你。

發生此錯誤是因為setup方法不希望版本具有file-.avro-VERSION.txt格式。 我懷疑字符“-”是解析器的困擾,因為它期望字符串結束而不是該字符。

我建議您嘗試使用requirements.txt文件上的官方版本之一,問題應該消失了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM