Package Publishing (Python) 通过 Poetry 失败

问题描述 投票:0回答:2

我对此很陌生,尝试使用 Poetry 包将包发布到 pypi.org。 在我的本地构建正在工作,我可以导入包测试运行它,一切都很好。

但是当我尝试将其发布到 pypi.org 时,我收到以下错误 - 根据我关注的文章Link,它应该提示我输入我的 pypi 帐户 ID 和密码,但它没有然后给出错误:


Publishing gsst (0.2.2) to PyPI
 - Uploading gsst-0.2.2-py3-none-any.whl 0%
 - Uploading gsst-0.2.2-py3-none-any.whl 100%

然后出现这个错误--

HTTP Error 403: Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information. | b'<html>\n <head>\n  <title>403 Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n \n <body>\n  <h1>403 Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n  Access was denied to this resource.<br/><br/>\nInvalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n\n\n \n'

在我运行 --poetrypublish 命令后,CLI 应该提示我输入 pypi、ID 和密码。为什么它会跳过它然后身份验证失败。

python pypi python-poetry
2个回答
2
投票

我终于解决了这个问题 - 从诗歌文档中获得帮助这里

发出以下命令来设置我的 pypi.org 帐户以进行自动身份验证

poetry config http-basic.pypi <username> <password>

之后我运行了“poetrypublish”命令并能够在 pypi.org 上发布我的包。

这确实是将包发布到 pypi.org 的最快、最简单的方法


0
投票

不直接使用您的 PyPI 用户名和密码,推荐的身份验证方法是使用 API 令牌

poetry config pypi-token.pypi <my-token>
© www.soinside.com 2019 - 2024. All rights reserved.