我已经安装了pippypirc并使用必需的密码设置了~/.pypirc文件。为什么每次调用twinepython 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中的第一个存储库。

关于python - 每次: how to use the . pypirc时,Twine都要求输入密码,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57935191/

10-12 21:24