You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Twine上传Python模块至TestPyPI时遭遇元数据缺失错误

使用Twine上传Python模块至TestPyPI时遭遇元数据缺失错误

我尝试用Twine把一个Python模块上传到TestPyPI,但遇到了一个看不懂的错误。我把我知道的所有信息都列在这里了,如果还需要其他信息请告诉我。我的TestPyPI账号已经注册完成,项目代码托管在代码仓库中,而且我已经把/dist文件夹上传到仓库了。

首先我执行了这个命令:

python3 -m build

得到的输出结果如下:

* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- hatchling
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- hatchling
* Getting build dependencies for wheel...
* Building wheel...

之后我运行了这条上传命令:

python3 -m twine upload --repository testpypi dist/*

结果收到了错误提示:

Uploading distributions to https://test.pypi.org/legacy/
ERROR    InvalidDistribution: Metadata is missing required fields: Name, Version.
        Make sure the distribution includes the files where those fields are specified, and is using a supported Metadata-Version: 1.0, 1.1, 1.2, 2.0, 2.1,
        2.2, 2.3.

下面是我的系统信息:

---- Ubuntu
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
---- Python
Python 3.10.12

我不知道怎么查看自己使用的元数据版本是多少。我在网上找过其他类似的求助帖子,但完全摸不着头绪。希望有人能给我一些帮助。

备注:内容来源于stack exchange,提问作者Mike O'Sullivan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 12:24:33