Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用twine将project的新版本上载到PyPI?_Python_Python 3.x_Package_Pypi_Twine - Fatal编程技术网

Python 如何使用twine将project的新版本上载到PyPI?

Python 如何使用twine将project的新版本上载到PyPI?,python,python-3.x,package,pypi,twine,Python,Python 3.x,Package,Pypi,Twine,我已经将Python包上传到PyPI。 但现在我制作了我的软件包的新版本,需要上传它。 我试图取得与第一次上传包时相同的进展。 但请告诉我这个错误: HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy 现在,如何上传新版本没有任何错误 您需要更改版本号。PyPI不允许重用分发文件名(

我已经将Python包上传到PyPI。 但现在我制作了我的软件包的新版本,需要上传它。 我试图取得与第一次上传包时相同的进展。 但请告诉我这个错误:

HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy

现在,如何上传新版本没有任何错误

您需要更改版本号。

PyPI不允许重用分发文件名(项目名称+版本号+分发类型)

这确保了给定项目的给定发行版的给定发行版将始终解析为同一文件,并且项目维护者或恶意方不会在某一天秘密更改该发行版(只能将其删除)

您需要将版本号更改为以前未上载到PyPI的版本号

您没有提到如何上载发行版,但如果您使用的是
twine
,也可能是您试图重新上载以前上载的发行版。要解决此问题,您可以执行以下操作:

$ twine upload --skip-existing dist/*

可能由于以下原因而导致该错误:

  • 未在
    setup.py中更改您的版本
  • 没有删除以前的dist文件
解决方案:

  • setup.py
    中更改版本号
  • 再次运行安装文件
    python setup.py bdist_wheel
  • 仅上载该dist文件或运行twine(如果使用)<代码>捆绳上载--跳过现有的dist/*

如@dustin所述,无法再次上载同名的dist文件。

在运行之前,请确保您的dist目录为空

python setup.py sdist

该错误似乎源于以下命令:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*
reusing the previous package version.
要解决此问题,请尝试以下方法:

twine upload --skip-existing --repository-url https://test.pypi.org/legacy/ 
dist/*

谢谢,救了我的命:)哦,我明白了,我需要删除文件夹中的旧dist。。。。那么就没有这样的错误消息了。