我正在尝试使用以下命令将 python 包上传到 PyPi:
pip install -e .
python setup.py bdist_wheel --universal
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
我收到这个错误:
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/
我还尝试了以下命令:
twine upload dist/*
twine upload --repository-url pypi dist/*
twine upload --repository-url https://upload.pypi.org/legacy dist/*
python setup.py bdist_wheel --universal upload
在同一目录中有一个 .pypirc 文件,我运行的命令是:
[distutils]
index-servers =
pypi
pypitest
[pypitest]
repository: https://testpypi.python.org/pypi/
username: <username>
password: <password>
[pypi]
repository: https://upload.pypi.org/legacy/
username: <username>
password: <password>
但我仍然被要求输入密码。 (也使用 pypitest 尝试过此操作,也在那里创建了一个帐户,但得到了同样的错误)
我也尝试过同样的操作,但删除了存储库行。
我要上传的包名曾经被占用,现在已经被移除了- https://pypi.python.org/pypi?name=&version=1.0.0&:action=display说找不到包裹
我使用的用户名和密码与我用来成功登录 https://pypi.python.org/pypi?%3Aaction=login_form 的用户名和密码相同
最佳答案
编辑:如果您使用的是 Windows,请检查 my other suggestion
我使用的帐户似乎出现了某种错误。以下步骤为我修复了它:
- 创建一个新帐户
- 使用
twine upload dist/*
使用新帐户上传包
- 将之前的帐户(您最初想要上传的帐户)作为所有者添加到包中
还要注意测试 pypi 服务器 --repository-url https://test.pypi.org/legacy/
,需要从实时服务器 创建一个不同的帐户--repository-url https://upload.pypi.org/legacy/
关于python - 无法使用 Twine 上传到 PyPi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46606692/