利用PyInstaller将python代码封装成EXE(亲测可用)

有些不能成功,有些不全的,下面总结一下,给自己以后看看。

1下载PyInstaller。。去官网下载http://www.pyinstaller.org/(我下载的版本)

2不需要安装,解压即可。如解压到D盘。

3进入cmd下面,

image

进入解压的文件下

image

4  写一个测试文件保存在D盘下,命名为Hello(参考1)

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 13 14:00:26 2014

@author: Administrator
"""

#!/usr/bin/env python
print 'Hello,World!'
words = raw_input('What do you want to say? ')
print 'you said:'+words

5执行封装:在cmd下写下面的语句。image

参考(2)

image

会出下如下结果

image。。。略

6在D:PyInstaller-2.1hellodisthello下面的exe就是可执行文件了image

参考1:http://huangliangnumber1.blog.163.com/blog/static/47811748201142282435469/

参考2:http://outofmemory.cn/code-snippet/2041/usage-pyinstaller-dabao-python-exe-file

原文地址:https://www.cnblogs.com/Dzhouqi/p/3598575.html