Python to Exe By Install PyInstaller on Win7-64bit
本文主要记录为史振华在尝试转换PY文件为EXE文件过程中各种疑惑和最终解决方法,尝试了PYTHON 2.7/3.5/3.6及其相关依赖pywin32-222.win32/pywin32-222.win-amd64。非常感谢IT笔记https://www.cnblogs.com/osfipin/p/4752728.html若能更早看过此文很有帮助,网上有大量相关文章但与本人现实中相当的不同。系统环境:Win7 Enterprise SP1/ intel i5-4310M CPU /System type:64-bit OS。2018/2/13
工具
python-3.6.4-amd64.exe:https://www.python.org/downloads/windows/
pywin32-222.win-amd64-py3.6.exe:https://github.com/mhammond/pywin32/releases
PyInstaller-3.3.1.tar:https://github.com/pyinstaller/pyinstaller
方法/步骤
运行python-3.6.4-amd64.exe,CPU是INTEL i5看到AMD64多少有些别扭,能选都选上路径都不改完成安装。确定PATH:Computer-System Properties-Advanced-Environment Variables...如:D:\users\f29691a\AppData\Local\Programs\Python\Python36。注意后续pywin32的版本需相同,PYTHON其他版本本身也能完成安装可最终安装PyInstaller或pywin32时报错无法顺利安装。
运行pywin32-222.win-amd64-py3.6.exe 安装中其会检测已安装的python版本,只有看到成功安装才有用。
解压PyInstaller-3.3.1.tar至D:根目录下,运行命令行CMD进入此目录,
//进入子目录 bootloader
cd bootloader
//build the bootloader 运行
python ./waf configure build install
//重新进入根目录
cd ..
//安装pyinstaller
python setup.py install
//from http://www.cnblogs.com/osfipin
#KEY#:安装中Reading https://pypi.python.org/simple/future/等一系列依赖,若error: Could not find suitable distribution forRequirement.parse('future')可在浏览器中打开上述网站确定链接正常后CMD中再次python setup.py install,亲测使用电信手机开热点给PC成功安装。
CMD至pyinstaller安装路径:pyinstaller --version命令
D:\ PyInstaller-3.3.1>pyinstaller --version
3.3.1若不行会显示各种缺少文件和语法错误。
CMD至pyinstaller安装路径,尝试转化一个简单的*.PY成*.exe:
pyinstaller -F D:\PYTHON\SHI.py
生成的EXE文件会被归档到子文件夹dist中。
原料
SHI.PY :功能为转换EXCEL文件名为AWL文件名内容未定。
import os;
print("Hello, World!");
#file_path=os.getcwd();
sourcefile=input("Drap *.xls to this window");
file_name=sourcefile+'.awl'
content='Hello\n,World\t'
print(content);
print(file_name);
if os.path.exists(file_name):
os.remove(file_name);
F=open(file_name,'a+');
F.write(content);
F.write(":D");
F.close();
input();
最新文章
- GeoServer中利用SLD配图之矢量图层配图
- (五)SQL Server分区自动化案例
- Winform开发框架之参数配置管理功能实现-基于SettingsProvider.net的构建
- c++builder调用VC的dll以及VC调用c++builder的dll
- dual,rowid,rownum
- cssText在 IE6/7/8和chrome/Firefox/IE9+的不同
- 【题解】【BT】【Leetcode】Binary Tree Level Order Traversal
- Windows下编译openssl
- ueditor的过滤、转义、格式丢失问题
- Ubuntu_10.04下Hadoop-0.20.2集群配置手册
- 变量a的定义
- HDU 4721 Food and Productivity (二分+树状数组)
- decimal ? 含义
- Express静态服务器
- centos ios镜像文件 安装详细
- Python第二十二天 stat模块 os.chmod方法 os.stat方法 pwd grp模块
- Mysql双主互备+keeplived高可用架构(部分)
- mysql存储过程异常处理
- 1.3 flask
- git的基本用法
热门文章
- 【Java GC系列】垃圾收集简介(1)
- docker搭建redis集群
- 力扣 - 142. 环形链表 II
- c#练习习题:while循环
- 23longest-consecutive-sequence
- svn“Previous operation has not finished; run 'cleanup' if it was interrupted“报错的解决方案
- jquery DataTable插件使用自定义搜索
- 2. Hive常见操作命令整理
- 预估Ceph集群恢复时间
- IP地址分类的计算方法