如何在win10上制作一个python包(探索版)
2016-11-26 17:38
281 查看
最近阅读一本python的书,head first python ,里面有讲到如何制作python包,并发表到pypi上,但是使用的是linux系统。win系统如何做呢?
其实,相对来说,很简单。但是又很麻烦。
1、制作两个文件。
setup.py文件,setup.py的相关参数:
另一个文件放自己的源代码。
两个文件的名字要一致。
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。
其实,相对来说,很简单。但是又很麻烦。
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。
相关文章推荐
- 如何使用 50 行 Python 代码制作一个计算器
- 如何用python制作一个锻炼计算能力的exe小程序-学习笔记11-pyinstaller
- 小白如何入门Python? 制作一个网站为例
- 黑莓开发新手入门教学帖,如何制作一个能控制LED颜色的程序(一)
- 如何为一个 .net 的 Web Application 制作一个安装程序
- 如何制作一个 https 网站?IIS配置HTTPS服务的方法
- 如何用c#来制作一个activeX控件或类似的东西
- [Python]如何取出一个超大文本文件的最后几行
- 如何制作一个 https 网站?IIS配置HTTPS服务的方法
- 如何用c#来制作一个activeX控件或类似的东西
- 如何制作一个 https 网站?IIS配置HTTPS服务的方法
- Mac OS X:如何制作一个可启动HFS+,一个FAT32,和一个NTFS分区(外置硬盘)
- 如何在页面内制作一个可以实现'另存为'的链接
- Mac OS X:如何制作一个可启动HFS+,一个FAT32,和一个NTFS分区(外置硬盘)
- 如何制作一个注册表文件
- 如何给网站制作一个.ico图标,附代码(图)
- [Python]如何取出一个超大文本文件的最后几行
- 如何制作一个带启动屏幕的窗体
- 如何制作一个防止多次刷新计数的图片计数器?
- Python中如何判断一个对象的布尔值