python 打包问题

twine upload dist/* 遇到下面的问题

Uploading distributions to https://upload.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.

环境:

  • 使用 pyproject.toml 配置包信息
  • 使用 python -m build 打包

错误信息分析
问题是没有指定包的 Name 和 version,但是 toml 文件中已经指定了。所以是 metadata 的版本不支持。查看打包出来的 PKG-INFO 会发现, metadata 是 2.3
https://github.com/pypa/packaging-problems/issues/735#issuecomment-2002497285
这里有说明是应为 pip 升级导致打包出来 2.3 的 metadata,此时需要升级 pkginfo ,twine 才能正常上传
pip install pkginfo==1.10.0
升级后,可以正常上传

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值