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

     最近阅读一本python的书,head first python ,里面有讲到如何制作python包,并发表到pypi上,但是使用的是linux系统。win系统如何做呢?

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

     1、制作两个文件。

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


Meta-Data Description Value Notes
name name of the package short string (1)
version version of this release short string (1)(2)
author package author’s name short string (3)
author_email email address of the package author email address (3)
maintainer package maintainer’s name short string (3)
maintainer_email email address of the package maintainer email address (3)
url home page for the package URL (1)
description short, summary description of the package short string  
long_description longer description of the package long string (5)
download_url location where the package may be downloaded URL (4)
classifiers a list of classifiers list of strings (4)
platforms a list of platforms list of strings  
license license for the package short 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




  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云金杞

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值