Welcome 微信登录

首页 / 操作系统 / Linux / PyInstaller 来建立Linux下的Python独立执行文件

以下内容假定已安装好Python 2.4/2.5 一、下载并编译pyinstaller(只需做一次,以后可直接做第二步) 1.下载pyinstaller,现在的版本是1.3
(1)wget http://pyinstaller.hpcf.upr.edu/source/1.3/pyinstaller_1.3.tar.gz 2.解包进入源码目录
(1)tar zxv pyinstaller_1.3.tar.gz
(2)cd pyinstaller-1.3/source/linux 3.编译源代码
(1)python Make.py  生成python的 .pyc文件 如无错误,则出现如下提示(只有一行):
Now run "make" to build the targets: ../../support/loader/run ../../support/loader/run_d (2)make 连接生成linux的 .o 文件 4.生成编译配置文件
(1)python Configure.py  生成config.dat配置文件
二、编译独立运行的python可执行文件 1.生成spec文件
python pyinstaller-1.3/Makespec.py --onefile --upx linuxlaptop.py 参数说明:
--onefile 生成单文件
--upx          生成压缩的文件(可减小执行文件体积,需先安装upx软件包)
2.生成最终的可执行文件
python pyinstaller-1.3/Build.py linuxlaptop.spec 在Linux下安装PythonUbuntu 11.10 安装剪贴板工具GPaste相关资讯      python 
  • Python 为什么要迁移到 Github  (01月26日)
  • Python 程序员最常犯的十个错误  (12/11/2015 18:32:46)
  • Python 面向对象编程  (10/06/2015 21:19:35)
  • Python 决定迁移到 GitHub  (01月03日)
  • Python面试必须要看的15个问题  (11/26/2015 22:23:21)
  • Python 开发者节省时间的 10 个方  (10/04/2015 06:58:39)
本文评论 查看全部评论 (0)
表情: 姓名: 字数