如何在 30 秒内将你的 Python 包上传到 PyPI
前提条件:安装 twine:
install-twine.sh
pip install twine在下一步之前,确保你没有未提交的文件,因为它们将被删除!
另外,确保你的包已准备好发布。确保你在 setup.py 中列出了正确的版本
upload-to-pypi.sh
sudo chown -R $USER: .
git clean -xdf
python3 setup.py sdist
twine upload dist/*如果你没有 python3 的变体:
upload-to-pypi-python2.sh
sudo chown -R $USER: .
git clean -xdf
python setup.py sdist
twine upload dist/*更详细的说明请参见此文章。
命令的详细解释:
sudo chown -R $USER: .修复可能由sudo python3 setup.pyinstall 引入的权限问题git clean -xdf删除未提交的文件和其他杂项python3 setup.py sdist构建源包twine upload dist/*这将要求你输入 PyPI 用户名和密码,然后上传包。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow