首页 > 编程语言 > 详细

python打包

时间:2018-07-03 19:22:52      阅读:211      评论:0      收藏:0      [点我收藏+]

一、RPM

准备环境

技术分享图片

安装脚本setup.py内容如下:

技术分享图片

在linux环境下执行打包编译命令: python2 setup.py bdist --formats=rpm

formats参数=wininst则会打包为.exe程序

技术分享图片

创建安装程序或包时,会出现一些错误和警告,只要看到

writing manifest file ‘MANIFEST‘
creating hello-1.0
making hard links in hello-1.0...
hard linking hello.py -> hello-1.0
hard linking setup.py -> hello-1.0
creating dist
tar -cf dist/hello-1.0.tar hello-1.0
gzip -f9 dist/hello-1.0.tar
tar -cf dist/hello-1.0.tar hello-1.0
gzip -f9 dist/hello-1.0.tar
removing ‘hello-1.0‘ (and everything under it)

类似的信息,就可以忽略告警和错误信息。

技术分享图片

pack目录下我放了两个模块,hello和hello_2,并且setup.py中参数也是py_modules=[‘hello‘,‘hello2‘],但是打包出来的tar包里,只有hello模块,这个比较奇怪~可能只能打包一个模块?·····

如果想重新构建,需要删除MANIFEST.in文件。

二、安装

发布的话,就直接发布hello-1.0.tar.gz。

 python setup.py install

 

python打包

原文:https://www.cnblogs.com/littlebird1/p/9259924.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!