![](/img/trans.png)
[英]Upload failed (403): Invalid or non-existent authentication information: Python
[英]403 Client Error: Invalid or non-existent authentication information while uploading to Pypi with twine
403 客戶端錯誤:使用 Twine 將新模塊上傳到 pypi 時出現無效或不存在的身份驗證信息
Win10 Pro 1803 Biuld 17134.1069 64 位 // Python 3.7.5 32 位 // pip 19.3.1
我成功創建了 tar。 和whl。 在 dist 文件夾中,在https://pypi.org/上注冊並通過電子郵件確認並開始上傳。
我用命令行檢查了兩個文件('PASSED')
並做了以下事情:
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: gakonorde
Enter your password:
Uploading gersyll-Alpha.release-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████| 6.43k/6.43k [00:01<00:00, 5.12kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/
命令行不允許我在用戶名后輸入密碼。 我只能按 ENTER。
我也試過
Password for 'your-username' in 'https://upload.pypi.org/legacy/':
...再一次,除了ENTER,我什么也不能按。
然后我使用https://pypi.org/及其測試版本的憑據創建.pypirc文件並再次運行python -m twine upload dist/*
我沒有被要求輸入密碼,但得到了同樣的錯誤:
Uploading distributions to https://upload.pypi.org/legacy/
Uploading gersyll-Alpha.release-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████| 6.43k/6.43k [00:01<00:00, 5.46kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/
當我將.pypirc與 API 令牌結合使用時,問題仍然存在。
我可以在https://pypi.org/上輸入我的帳戶,所以它顯然存在(並且電子郵件已驗證)。
我還添加了第二封電子郵件,經過驗證並將其設置為主要電子郵件(沒有任何改變)。
這是我的 setup.py:
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="gersyll",
version="Alpha release",
author="gakonorde",
author_email="gabrielko@yandex.ru",
description="This module counts the number of words of different syllable length for all texts in a directory",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/gakonorde/gersyll",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.7',
)
我究竟做錯了什么?
任何幫助將不勝感激。
編輯: .pypirc 文件與 .setup、README、License、dict/ 等位於同一文件夾中。
其內容如下:
[distutils]
index-servers =
pypi
pypitest
[pypitest]
repository: testpypi.python.org/pypi
username: gakonorde
password: [my_password]
[pypi]
repository: upload.pypi.org/legacy
username: gakonorde
password: [my_password]
解決了
python -m twine upload -u USERNAME -p PASSWORD dist/*
關於密碼提示,在 Enter your password: 提示之后您將看不到任何輸入,因為它隱藏了您的密碼。
對於您的.pypirc
文件,它應該位於您的主目錄 ( ~/.pypirc
) 中,而不是與setup.py
文件位於同一目錄中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.