在 PyPi 上更新包的指南 [英] A guide for updating packages on PyPi
问题描述
我使用本指南在 PyPi 上安装了一个新包.
I used this guide to install a new package on PyPi.
现在,我想更新包.由于我没有找到这方面的指南,我尝试自己做:我将版本从1.0.0.dev1"更新为1.0.0.dev2"并重新安装.它没有用:我得到了:
Now, I want to update the package. Since I found no guide for this, I tried to do it myself: I updated the version from "1.0.0.dev1" to "1.0.0.dev2" and re-installed. It did not work: I got:
Uploading tee_table-1.0.0.dev1-py3-none-any.whl
HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/
我也阅读了这个问题,但信息似乎已经过时(从 2012 年开始).
I also read this question but the information seems outdated (from 2012).
是否有简单的用户指南来描述如何将包的新版本上传到 PyPi?
Is there a simple user guide that describes how to upload a new version of a package to PyPi?
推荐答案
我发现我的问题是什么 - 我没有删除 dist 文件夹中的旧文件,所以上传者试图在新文件之前上传它们,并且失败的.解决方案是:
I found out what my problem was - I did not delete the old files in the dist folder, so the uploader tried to upload them before the new files, and failed. The solution was to:
一个.删除 dist 文件夹中的所有文件.
a. Delete all files in the dist folder.
B.更新 setup.py 文件中的版本号.
b. Update the version number in the setup.py file.
c.重新创建轮子:
python3 setup.py sdist bdist_wheel
d.重新上传新文件:
twine upload dist/*
这篇关于在 PyPi 上更新包的指南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!