Twine 每次都要求我输入密码:如何使用 .pypirc

Twine is asking for my password each time : how to use the .pypirc

我已经 pip 安装了 pypirc 并使用必要的密码设置了 ~/.pypirc 文件。为什么 twine 每次调用 python setup.py 时都要求输入密码?

  $twine upload --repository-url https://test.pypi.org/legacy/ dist/*
  Enter your username:

这是 .pypirc

的形式
[distutils] # this tells distutils what package indexes you can push to
index-servers =
  pypi
  pypitest

[pypi]
repository: https://pypi.python.org/pypi
username: myuser 
password: mypwd 

[pypitest]
repository: https://testpypi.python.org/pypi
username: myuser 
password: mypwd 

更新 不包括 --repository-url 给出:

UploadToDeprecatedPyPIDetected: You're trying to upload to the legacy PyPI site 'https://pypi.python.org/pypi'. Uploading to those sites is deprecated.
 The new sites are pypi.org and test.pypi.org. Try using https://upload.pypi.org/legacy/ (or https://test.pypi.org/legacy/) to upload your packages instead. These are the default URLs for Twine now.
 More at https://packaging.python.org/guides/migrating-to-pypi-org/ .
twine upload dist/*

twine upload -r pypi dist/*

twine upload -r pypitest dist/*

据我了解 twine --repository-url <url> 甚至没有咨询 ~/.pypirc。使用 -r <name>,它会查找 ~/.pypirc 以获得 URL、用户名和密码。如果省略 -r <name>,twine 将使用 ~/.pypirc.

中的第一个 repo

只需在 c:\user\your-name
中找到 .pypirc 它会起作用...

方法一:

python -m twine upload  dist/* -u%username% -p%password%

你可以

设置用户名="令牌"

设置密码="pypi-AgEIc..."

设置用户名=pypi名称

设置密码=pypi密码