正在自学Ninad Sathaye - Learning Python Application Development (2016, Packt Publishing - ebooks Account)。有一章节是将自己的代码上传到testPyPI。
在自己的用户目录下新建一个空白文件命名为.pypirc。在该文件中,我输入了自己的用户名和密码,假定用户名是abc,密码是123。一开始我输入的内容如下:
[distutils]
index-servers=
pypi
testpypi
[testpypi]
repository = https://test.pypi.org/legacy/
username= <abc>
password= <123>
在Anaconda的命令窗口中运行如下代码:
twine upload --repository testpypi dist/*
此时报错:
HTTPError: 403 Client Error: Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for details for url: https://test.pypi.org/legacy/
在网上搜索一番后,怀疑是我的用户名和密码输入有误,把用户名和密码中的<>去掉,问题得到解决。
[distutils]
index-servers=
pypi
testpypi
[testpypi]
repository = https://test.pypi.org/legacy/
username= abc
password= 123
参考资料: