无法将包上传到 PyPI:410 Gone [英] Failed to upload packages to PyPI: 410 Gone
问题描述
在 pypi.python.org 迁移到 pypi 之后.org,我在尝试像往常一样使用以下命令将包上传到 PyPI 时出错:
After pypi.python.org has been migrated to pypi.org, I got an error when trying to upload a package to PyPI using the command as usual:
python2.7 setup.py sdist上传
错误信息是:
Upload failed (410): Gone(此 API 已被弃用并从旧 PyPI 中删除,以支持使用 PyPI 的新 PyPI.org 实现(位于 https://pypi.org/). 有关将此 API 的使用迁移到 PyPI.org 的更多信息,请参阅 https://packaging.python.org/guides/migrating-to-pypi-org/#uploading.有关停用的更多信息这个API,请看https://mail.python.org/pipermail/distutils-sig/2017-June/030766.html)
我查看了消息中提到的解决方案,然后用谷歌搜索了一下.不幸的是,我发现的解决方案不起作用,包括更新我的本地 ~/.pypirc
文件.像这样:
I looked into the solution mentioned in the message and then googled a little bit. Unfortunately, the solutions I found were not working, including updating my local ~/.pypirc
file. Like this:
[distutils]
index-servers =
pypi
[pypi]
repository:https://pypi.python.org/pypi or repository:https://upload.pypi.org/legacy/
username:yourusername
password:yourpassword
我仍然收到相同的错误消息.我该怎么办?
I still got the same error message. What should I do?
推荐答案
升级到最新的 pip 和 setuptools;安装麻线:
Upgrade to the very latest pip and setuptools; install twine:
pip install -U pip setuptools twine
编辑~/.pypirc
并注释掉或删除repository
:
[pypi]
#repository:https://pypi.python.org/pypi
使用 twine 从包含模块源、setup.py 和其他文件的文件夹中将您的模块上传到 pypi:
Use twine to upload your module to pypi from within the folder containing the module source, setup.py, and other files:
python setup.py sdist
twine upload dist/*
参见 https://packaging.python.org/guides/迁移到 pypi-org/#uploading
这篇关于无法将包上传到 PyPI:410 Gone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!