解決twine upload時HTTPError: 403 Client Error: Invalid or non-existent authentication information.

       正在自學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

 

參考資料:

[1]  發佈你自己的輪子 - PyPI打包上傳實踐

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章