共享代码全过程(python package index)PyPI网站

一、首先需要创建两个文件

文件一:python代码(注释+代码)

文件二:创建setup.py

跟文件一放在同一文件夹下
from distutils.core import setup

setup(
    name='nester',
    version='1,0,0',
    py_modules=['nester'],
    author = 'cyyfabulous',
    author_email='[email protected]',
    url='http://www.headfirstlabs.com',
    description = 'A simple printer of nester lists',
)

在Windows的CMD中输入

D:\python\python自学\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

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)

将发布安装到python本地副本中

D:\python\python自学\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
copying build\lib\nester.py -> D:\python\Lib\site-packages
byte-compiling D:\python\Lib\site-packages\nester.py to nester.cpython-36.pyc
running install_egg_info
Removing D:\python\Lib\site-packages\nester-1_0_0-py3.6.egg-info
Writing D:\python\Lib\site-packages\nester-1_0_0-py3.6.egg-info

安装前后文件夹差别:
共享代码全过程(python package index)PyPI网站

D:\python\python自学\nester>python setup.py register

D:\python\python自学\nester>python setup.py sdist upload

就可以了
只是我的一直是error

剩下的一直出不来,悲伤,好像需要定义一个文件才能运行
http://www.zhimengzhe.com/bianchengjiaocheng/qit*cheng/243040.html