python转成exe_将python程序转换成exe程序

将python程序转换成exe.

一、 先安装python

2、安装下载包,一路next。

3、为计算机添加安装目录搭到环境变量,如图把python的安装目录添加到pth系统变量中即

可。(D:\\python32 是python的安装路径)

wKioL1R1RgXzi_v-AATzEpHsWUE474.jpg

4、测试python安装是否成功,cmd打开命令行输入 python 命令,如下图即成功了

wKioL1R1RlCgFvfzAACZb9vZLIs659.jpg

6、直接解压安装到python的安装目录即可,C:\Python27\pyinstaller (pyinstaller 就是解压后的目录

7、进入到安装pyinstaller的目录,新建一个存放py文件的目录,在新建的目录里放置我们的py程序

8、C:\Python27\PyInstaller-3.1.1

9、 转换成exe.

在命令行执行:python Makespec.py --console --onefile net\deploy_web.py

wKiom1cEwPXQyx5RAABhacP4bvQ501.png

也许你会出现以下错误,也许不会,不报错直接第9步

报错:Configfile is missing or unreadable. Please run Configure.py before building

10、解决方法:

在命令行执行:Configure.py

报错:Python 2.6+ on Windows support needs pywin32,Please install http://sourceforge.net/projects/pywin32/

如果Python版本太低,则安装最新版本的 pywin32-217.win32-py2.7.exe,下载地址:http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/

无错误时候,继续执行上 第9步

wKioL1cEwrfRkB-oAACJnV_U_i0439.png

关于-F 参数解释:

-F, --onefile

create a single file deployment

-D, --onedir

create a single directory deployment (default)

-o DIR, --out=DIR

create the spec file in directory. If not specified, and the current directory is Installer’s root directory, an output subdirectory will be created. Otherwise the current directory is used.

-n NAME, --name=NAME

optional name to assign to the project (from which the spec file name is generated). If omitted, the basename of the (first) script is used.

11、成功后生成一个和py脚本同名的目录(deploy_web),在dict目录下就生成一个.exe 程序。

wKiom1cEwj7y4JKzAADccadQJ5s398.png

12、执行完.exe程序后生成一个txt文件,里面就是想要的信息、

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值