zoukankan      html  css  js  c++  java
  • chapter10.4、打包分发

    包管理

    python的模块或者源文件可以直接复制到目标项目目录中,就可以导入使用了。

    目的是为了复用

    Pypi(Python Package Index),公共的模块储存中心,https://pypi.org

    主要工具有:

    distutils

      官方库,使用安装脚本setup.py来构建,安装包

      2000年已停止开发

    setuptools

      替代distutils的增强版工具集,包含easy_install.py文件,使用ez_setup.py文件,支持egg格式来构建和安装。

      是包管理的核心模块

    pip

      目前是包管理的事实标准

      构建在setuptools之上,从Python3.4开始直接包含在安装文件中

    wheel

      wheel格式定义在PEP427中

      wheel文件中不包含.pyc文件

      提供bdist_wheel 作为setuptools 的扩展命令,可以生成新打包格式wheel。

      pip从1.4版本开始提供wheel子命令来安装wheel包,需要先安装wheel模块

      它可以让Python库以二进制的形式安装,而不需要本地编译。

    from distutils.core import setup
    
    setup(name='Distutils',
          version='1.0',
          description='Python Distribution Utilities',
          author='Greg Ward',
          author_email='gward@python.net',
          url='https://www.python.org/sigs/distutils-sig/',
          packages=['distutils', 'distutils.command'],
         )
    
    #name 名字
    #version 版本
    #packages=[] 打包列表
    #description 描述信息
    #author 作者
    #url 包的主页,可以不写
    #author_email 作者邮箱

    打包列表时,指定目录,就会把目录下的所有非目录子模块打包,

  • 相关阅读:
    hdu1251 && hud 1247 (字典树)
    linux系统调用kernel code
    Android init.rc 服务启动不成功
    android init执行service的脚本code位置
    printk %pS %pF含义
    进程页表图示
    linux内核之进程的基本概念(进程,进程组,会话关系)
    What is the purpose of the controlling terminal?
    android init.rc中service console option的含义、作用
    启动和停止init.rc中的服务
  • 原文地址:https://www.cnblogs.com/rprp789/p/9768180.html
Copyright © 2011-2022 走看看