将自己的包上传到pypi

1. 环境准备:

 1. 在官网上注册账户: https://pypi.org/account/login/

# 安装编译工具  
pip install setuptools wheel
# 编译生成安装包
python setup.py sdist bdist_wheel
# 安装上传工具
pip install --user --upgrade twine
# 上传包命令
python -m twine upload --repository pypi dist/*

# 需要使用注册的用户和密码
# 需要在邮箱上验证邮箱

2. 准备setup.py 文件

from setuptools import setup, find_packages

APP = ['ultipa']
DATA_FILES = []
OPTIONS = {}

setup(
    app=APP,
    name="XXXX",
    version="XXXXX",
    packages=find_packages(),  # 常用,要熟悉 :会自动查找当前目录下的所有模块(.py文件) 和包(包含__init___.py文件的文件夹)
    # scripts = ['say_hello.py'],
    # Project uses reStructuredText, so ensure that the docutils get
    # installed or upgraded on the target machine
    install_requires=[
                依赖包
                ],  # 常用
    package_data={
        # If any package contains *.txt or *.rst files, include them:
        '': ['*.txt', '*.rst',"printer"],
        # And include any *.msg files found in the 'hello' package, too:
        'hello': ['*.msg'],
    },
    # metadata for upload to PyPI
    author="XXXX",
    author_email="XXXXX",
    description="XXXXX",
    license="PSF",
    keywords="XXXXX",
    url="XXXXXXXXX",  # project home page, if any
    # could also include long_description, download_url, classifiers, etc.
)

  

 

posted @ 2026-05-27 10:33  Py浪涛  阅读(6)  评论(0)    收藏  举报
你想听歌吗o((;=゚ 3゚ =))o~♪