jialexu

https://jingyan.baidu.com/article/59a015e375f55af794886591.html

一、准备发布

1、创建一个nester.py 模块,创建nester 文件夹将nester.py模块复制到这个文件夹

"# Author:guangqing"
\'\'\' 这是 "nester" 模块,提供了一个名为print_lol()的函数,这个函数的作用是打印列表,其中有可能包含(也有可能不包含嵌套列表的类别)嵌套列表 \'\'\'
def print_lol(the_list):
    \'\'\'这个函数取一个位置参数,名为 \'the_list\'这可以是任何python列表(也可以是包含嵌套列表的列表)。所指定的列表中的每个数据项会(递归的)输出到屏幕上,各个数据各占一行 \'\'\'
    for each_item in the_list:
        if isinstance(each_item,list):
            print_lol(each_item)
        else:
            print(each_item) 

2、在新文件夹中创建一个名为setup.py的文件;

from distutils.core import setup

setup(
    name=\'nester\',
    version=\'1.0.0\',
    py_modules =[\'nester\'],
    author=\'jiale\',
    author_email=\'18521093275@163.com\',
    url=\'http://www.headfirstlabs.com\',
    
    description=\'这是我的第一个发布安装文件\'
)

二、准备发布

1、接下来我们打开cmd窗口,进入到上面建立的文件夹下面,然后执行python setup.py sdist命令,如下图所示(shift+右键,在此处打开powershell窗口)

PS D:\nester> python setup.py sdist
running sdist
running check
warning: sdist: manifest template \'MANIFEST.in\' does not exist (using default file list)

warning: sdist: standard file not found: should have one of README, README.txt, README.rst

writing manifest file \'MANIFEST\'
creating nester-1.0.0
making hard links in nester-1.0.0...
hard linking nester.py -> nester-1.0.0
hard linking setup.py -> nester-1.0.0
creating dist
Creating tar archive
removing \'nester-1.0.0\' (and everything under it)
PS D:\nester>

2、将发布安装到你的python本地副本中。

PS D:\nester> python setup.py install
running install
running build
running build_py
creating build
creating build\lib
copying nester.py -> build\lib
running install_lib
running install_egg_info
Removing D:\python\Lib\site-packages\nester-1.0.0-py3.7.egg-info
Writing D:\python\Lib\site-packages\nester-1.0.0-py3.7.egg-info
PS D:\nester>

 

1、在python 或IDLE shell中,键入dir(__builtins__)可以看到Python提供的内置方法列表;那些小写的单词都是BIF。要查看某个BIF做什么,比如说input(),可以在shell中键入help(input),就会得到这个BIF的功能描述;

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-08-14
  • 2021-05-08
  • 2021-11-03
  • 2021-07-14
  • 2022-02-03
  • 2021-11-23
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2022-02-14
  • 2022-01-10
  • 2021-11-23
相关资源
相似解决方案