本文主要记录为史振华在尝试转换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();

最新文章

  1. GeoServer中利用SLD配图之矢量图层配图
  2. (五)SQL Server分区自动化案例
  3. Winform开发框架之参数配置管理功能实现-基于SettingsProvider.net的构建
  4. c++builder调用VC的dll以及VC调用c++builder的dll
  5. dual,rowid,rownum
  6. cssText在 IE6/7/8和chrome/Firefox/IE9+的不同
  7. 【题解】【BT】【Leetcode】Binary Tree Level Order Traversal
  8. Windows下编译openssl
  9. ueditor的过滤、转义、格式丢失问题
  10. Ubuntu_10.04下Hadoop-0.20.2集群配置手册
  11. 变量a的定义
  12. HDU 4721 Food and Productivity (二分+树状数组)
  13. decimal ? 含义
  14. Express静态服务器
  15. centos ios镜像文件 安装详细
  16. Python第二十二天 stat模块 os.chmod方法 os.stat方法 pwd grp模块
  17. Mysql双主互备+keeplived高可用架构(部分)
  18. mysql存储过程异常处理
  19. 1.3 flask
  20. git的基本用法

热门文章

  1. 【Java GC系列】垃圾收集简介(1)
  2. docker搭建redis集群
  3. 力扣 - 142. 环形链表 II
  4. c#练习习题:while循环
  5. 23longest-consecutive-sequence
  6. svn“Previous operation has not finished; run 'cleanup' if it was interrupted“报错的解决方案
  7. jquery DataTable插件使用自定义搜索
  8. 2. Hive常见操作命令整理
  9. 预估Ceph集群恢复时间
  10. IP地址分类的计算方法