码迷,mamicode.com
首页 > 编程语言 > 详细

Python发布

时间:2016-05-16 01:47:49      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

  1. 把新建的以下模块(nester.py)共享,需要准备一个发布。
    def print_lol(the_list):
           """The file name is nester.py. print each_item for list"""
           for each_item in the_list:
                  if isinstance(each_item,list):
                         print_lol(each_item)
                  else:
                         print each_item
  2. 新建一个文件夹nester 把nester.py放进nester文件夹中。在nester文件夹中新建setup.py文件,添加如下代码:
    from distutils.core import setup
    setup(
           name   = "nester",
           version = "1.0.0",
           py_modules = [nester],
           author = jonnylee,
           author_email = lichaoning@trthi.com,
           url = https://www.baidu.com,
           description = A simple printer of nested lists,
    
           )
  3. 保存成功后,打开终端进入nester文件夹下,执行如下命令:
     1 $ python setup.py sdist
     2 running sdist
     3 running check
     4 warning: sdist: manifest template MANIFEST.in does not exist (using default file list)
     5 
     6 warning: sdist: standard file not found: should have one of README, README.txt
     7 
     8 writing manifest file MANIFEST
     9 creating nester-1.0.0
    10 making hard links in nester-1.0.0...
    11 hard linking nester.py -> nester-1.0.0
    12 hard linking setup.py -> nester-1.0.0
    13 Creating tar archive
    14 removing nester-1.0.0 (and everything under it)
  4. 出现以上问题执行$  sudo python setup.py sdist 如果任然出现以上问题。查看nester文件加下是否生成了dist文件夹,在dist文件夹找到并解压nester-1.0.0.tar.gz文件解压
  5. 进入到nester-1.0.0目录下 执行python setup.py install 命令 发布成功:
     1 $ python setup.py install
     2 running install
     3 running build
     4 running build_py
     5 creating build
     6 creating build/lib
     7 copying nester.py -> build/lib
     8 running install_lib
     9 running install_egg_info
    10 Removing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nester-1.0.0-py2.7.egg-info
    11 Writing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nester-1.0.0-py2.7.egg-info

     

Python发布

标签:

原文地址:http://www.cnblogs.com/afeiya/p/5496786.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!