您的位置:首页 > 编程语言 > Python开发

如何在win10上制作一个python包(探索版)

2016-11-26 17:38 281 查看
     最近阅读一本python的书,head first python ,里面有讲到如何制作python包,并发表到pypi上,但是使用的是linux系统。win系统如何做呢?

     其实,相对来说,很简单。但是又很麻烦。

     1、制作两个文件。

         setup.py文件,setup.py的相关参数:



Meta-DataDescriptionValueNotes
namename of the packageshort string(1)
versionversion of this releaseshort string(1)(2)
authorpackage author’s nameshort string(3)
author_emailemail address of the package authoremail address(3)
maintainerpackage maintainer’s nameshort string(3)
maintainer_emailemail address of the package maintaineremail address(3)
urlhome page for the packageURL(1)
descriptionshort, summary description of the packageshort string 
long_descriptionlonger description of the packagelong string(5)
download_urllocation where the package may be downloadedURL(4)
classifiersa list of classifierslist of strings(4)
platformsa list of platformslist of strings 
licenselicense for the packageshort string(6)
      另一个文件放自己的源代码。
       两个文件的名字要一致。

2、进入cmd,用python setup.py sdist 命令制作python包;

     可以使用python
setup.py --help-commands


     查看setup.py相关参数:

Standard commands:

  build            build everything needed to install

  build_py         "build" pure Python modules (copy to build directory)

  build_ext        build C/C++ extensions (compile/link to build directory)

  build_clib       build C/C++ libraries used by Python extensions

  build_scripts    "build" scripts (copy and fixup #! line)

  clean            clean up temporary files from 'build' command

  install          install everything from build directory

  install_lib      install all Python modules (extensions and pure Python)

  install_headers  install C/C++ header files

  install_scripts  install scripts (Python or otherwise)

  install_data     install data files

  sdist            create a source distribution (tarball, zip file, etc.)

  register         register the distribution with the Python package index

  bdist            create a built (binary) distribution

  bdist_dumb       create a "dumb" built distribution

  bdist_rpm        create an RPM distribution

  bdist_wininst    create an executable installer for MS Windows

  check            perform some checks on the package

  upload           upload binary package to PyPI


关键问题是,会出现这样一个错误,就不能继续下去了。找了很多种解决办法, 仍然不行






使用python setup.py bdist可以生成相应的包,我在本地是可以安装到自己的python上了,并且可以用import 调用,但是似乎不能用pip 安装。

等有时间在来解决这个问题。打住这个问题,以后再来解决。去学习下如何用python制作APP。



  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: