首页 > 解决方案 > pip install 无法从工件解析版本

问题描述

在 ubuntu 机器上使用pip install -r requirement.txt(它有 avro-python3)安装时。我收到以下错误,它曾经是前一段时间的警告,但现在它导致错误。

Collecting avro-python3==1.9.2.1
  Downloading https://artifactory/avro-python3-1.9.2.1.tar.gz (37 kB)
WARNING: Requested avro-python3==1.9.2.1 from https://artifactory/avro-python3-1.9.2.1.tar.gz#sha256=ca1e77a3da5ac98e8833588f71fb2e170b38e34787ee0e04920de0e9470b7d32 (from -r requirements.txt (line 4)), but installing version file-.avro-VERSION.txt
ERROR: Requested avro-python3==1.9.2.1 from  https://artifactory/avro-python3-1.9.2.1.tar.gz#sha256=ca1e77a3da5ac98e8833588f71fb2e170b38e34787ee0e04920de0e9470b7d32 (from -r requirements.txt (line 4)) has different version in metadata: 'file-.avro-VERSION.txt'

我的 requirements.txt 看起来像

avro-python3==1.9.2.1

有没有办法避免这个错误?

为了解决它需要修复什么?

有没有办法可以在 requirements.txt 中指定?不为这个包使用神器?

标签: pythonpython-3.xpipartifactory

解决方案


avro-python3-1.9.2.1.tar.gzPyPI下载。它的setup.cfg文件看起来像:

[metadata]
name = avro-python3
version = file: avro/VERSION.txt
description = Avro is a serialization and RPC framework.
...

注意版本行和file:符号。这个符号是在setuptools 39.2.0中添加的:

因此,请确保您的setuptools版本至少为39.2.0,并且它可能会更好地工作(也许升级pip也会有所帮助)。


推荐阅读