实例讲解Python脚本成为Windows中运行的exe文件
作者:laozhang 时间:2023-07-15 02:14:31
将程序转换为exe文件
我们先来介绍如何使用工具Pyinstaller
安装Pyinstaller
我们用pip安装Pyinstaller 。
注意,如果使用Pyinstaller,则应使用python 2.7或python 3.3到python 3.6(截至2018年7月)的环境。
安装方法非常简单,我们执行以下命令
$ pip install pyinstaller
接下来我们将python脚本转换为exe文件
我们将“.py”文件转换为“.exe”文件
首先,我们创建原始的“.py”文件。
这次使用以下显示“Hello World!”的文件(test.py)。
#! /usr/bin/env python
# coding: UTF-8
print("Hello World!")
转换时,执行以下命令。
$ pyinstaller test.py
可以看到上面的test.py进程已完成。
Hello World!
标签:Python,Windows,exe
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python要求O(n)复杂度求无序列表中第K的大元素实例
2023-07-30 13:18:01
![](https://img.aspxhome.com/file/2023/3/77833_0s.jpg)
Spring Boot整合 NoSQL 数据库 Redis详解
2024-01-29 18:16:36
![](https://img.aspxhome.com/file/2023/1/130011_0s.jpg)
关于Pytorch中模型的保存与迁移问题
2023-08-11 04:05:25
六种酷炫Python运行进度条效果的实现代码
2022-06-07 05:22:16
![](https://img.aspxhome.com/file/2023/3/68493_0s.gif)
jquery常用的表单操作很全很详细
2011-09-01 19:21:11
Python实现随机生成图片验证码详解
2023-02-26 12:20:20
![](https://img.aspxhome.com/file/2023/2/89042_0s.jpg)
YiiFramework入门知识点总结(图文教程)
2023-11-20 18:41:03
![](https://img.aspxhome.com/file/2023/4/88274_0s.jpg)
go-cqhttp智能聊天功能的实现
2024-04-26 17:30:53
![](https://img.aspxhome.com/file/2023/0/134020_0s.png)
PyQt5实现简单数据标注工具
2021-10-24 04:55:54
![](https://img.aspxhome.com/file/2023/9/97419_0s.jpg)
关于python3安装pip及requests库的导入问题
2021-10-06 11:23:26
![](https://img.aspxhome.com/file/2023/5/115015_0s.png)
python Requsets下载开源网站的代码(带索引 数据)
2023-01-03 13:19:11
python实现学生管理系统开发
2021-08-26 20:43:17
php 备份数据库代码(生成word,excel,json,xml,sql)
2024-06-05 09:52:42
php session_start()出错原因分析及解决方法
2024-06-07 15:44:29
各种Python库安装包下载地址与安装过程详细介绍(Windows版)
2021-01-27 14:00:05
![](https://img.aspxhome.com/file/2023/9/89089_0s.png)
Python面向对象之反射/自省机制实例分析
2022-07-27 06:57:53
mysql查询字符串替换语句小结(数据库字符串替换)
2024-01-25 12:56:51
用SQL语句查询数据库中某一字段下相同值的记录方法
2024-01-23 14:49:54
javascript实现rgb颜色转换成16进制格式
2024-04-18 09:33:58
js+html5操作sqlite数据库的方法
2024-01-23 18:31:05