18

我已经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/ .
4

4 回答 4

14
twine upload dist/*

或者

twine upload -r pypi dist/*

或者

twine upload -r pypitest dist/*

据我了解twine --repository-url <url>,甚至没有咨询~/.pypirc。使用-r <name>它查找~/.pypircURL、用户名和密码。如果省略-r <name>,则 twine 使用来自~/.pypirc.

于 2019-09-14T13:39:23.437 回答
0

我很好奇最终的答案。我遇到了完全相同的问题。我在主文件夹中有一个 .pypirc ,其中包含以下内容,但是twine upload -r pypi dist/*,它仍然要求提供凭据。

[distutils]
index-servers =
    pypi
    testpypi
    Amplo

[pypi]
username: __token__
password: ***

[testpypi]
username: __token__
password: ***

[Amplo]
repository: https://upload.pypi.org/legacy/
username: __token__
password: ***
于 2021-05-21T11:57:39.463 回答
0

方法一:

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

你可以

设置用户名=“令牌

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

或者

设置用户名=pypi 名称

设置密码=pypi密码

于 2022-01-19T06:53:08.370 回答
0

只需在 c:\user\your-name 中找到 .pypirc 即可
...

于 2021-11-27T20:34:08.000 回答