简体   繁体   English

403 客户端错误:使用 twine 上传到 Pypi 时验证信息无效或不存在

[英]403 Client Error: Invalid or non-existent authentication information while uploading to Pypi with twine

403 Client Error: Invalid or non-existent authentication information occurs when uploading new module to pypi with Twine 403 客户端错误:使用 Twine 将新模块上传到 pypi 时出现无效或不存在的身份验证信息

Win10 Pro 1803 Biuld 17134.1069 64 bit // Python 3.7.5 32 bit // pip 19.3.1 Win10 Pro 1803 Biuld 17134.1069 64 位 // Python 3.7.5 32 位 // pip 19.3.1

I successfully created tar.我成功创建了 tar。 and whl.和whl。 in the dist folder, registered on https://pypi.org/ with e-mail confirmation and started to upload.在 dist 文件夹中,在https://pypi.org/上注册并通过电子邮件确认并开始上传。

I checked both files with command line ('PASSED')我用命令行检查了两个文件('PASSED')

and did the following:并做了以下事情:

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/

The command line does not allow me to enter password after username.命令行不允许我在用户名后输入密码。 I only can press ENTER.我只能按 ENTER。

I tried also我也试过

Password for 'your-username' in 'https://upload.pypi.org/legacy/':

... and again, I can press nothing except of ENTER. ...再一次,除了ENTER,我什么也不能按。

Then I created .pypirc file with credentials for https://pypi.org/ and its test version and run python -m twine upload dist/* again然后我使用https://pypi.org/及其测试版本的凭据创建.pypirc文件并再次运行python -m twine upload dist/*

I was not asked for a password, but got the same error:我没有被要求输入密码,但得到了同样的错误:

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/

When I combine .pypirc with API token, the problem remains the same.当我将.pypirc与 API 令牌结合使用时,问题仍然存在。

I can enter my account on https://pypi.org/ , so it obviously exists (and e-mail is verified).我可以在https://pypi.org/上输入我的帐户,所以它显然存在(并且电子邮件已验证)。

I also added the second e-mail, verified and set it as primary (nothing changed).我还添加了第二封电子邮件,经过验证并将其设置为主要电子邮件(没有任何改变)。

Here is my setup.py:这是我的 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',
)

What am I doing wrong?我究竟做错了什么?

Any help would be greatly appreciated.任何帮助将不胜感激。

Edit: The.pypirc file is in the same folder as.setup, README, License, dict/ etc.编辑: .pypirc 文件与 .setup、README、License、dict/ 等位于同一文件夹中。

It's content is as follows:其内容如下:

[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]

Solved with解决了

python -m twine upload -u USERNAME -p PASSWORD dist/*

With regards to the password prompt, you won't see any input after the Enter your password: prompt, because it's hiding your password.关于密码提示,在 Enter your password: 提示之后您将看不到任何输入,因为它隐藏了您的密码。

For your .pypirc file, this should be in your home directory ( ~/.pypirc ), not in the same directory as your setup.py file.对于您的.pypirc文件,它应该位于您的主目录 ( ~/.pypirc ) 中,而不是与setup.py文件位于同一目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM