打包分发仅需两条命令
先注册一个pypi的账号
链接:https://pypi.org
1、准备setup文件,放在与项目同级的目录
简单的setup文件如下就行
from distutils.core import setup
setup(
name = "projectname", #
author = "xxxx",
version = "1.0.0",
author_email = "[email protected]",
url = "http://www.xxx.com"
)
2、准备.pypirc文件,放在C:/用户/
[distutils]
index-servers =
pypi
[pypi]
repository:https://test.pypi.org/legacy/
username:pypiusername
password:pypipassword
3、python setup.py check
先做一些检查
注意有没有错误和警告
4、python setup.py sdist upload -r pypi
直接打包发布
最后奉上文档连接
https://packaging.python.org/tutorials/packaging-projects/
完成
原文地址:https://www.cnblogs.com/aaronhua/p/11181616.html
时间: 2024-11-27 00:38:57