终于弄好了,哈哈哈~~~
明天更新
安装pyinstaller之前,要先安装pywin32:
http://sourceforge.net/projects/pywin32/files/pywin32/
然后安装pyinstaller:
以下均在cmd下:
确认是否安装好:
pyinstaller --version,若显示版本信息,表示已安装好。
把.py脚本编译.exe:
进入.py脚本所在目录(记住是在cmd下),然后:pyinsatller -F helloworld.py(单文件),或者pyinstaller helloworld.py(生成文件夹)
加入图标:
遇到了一些问题,我发现我只有在http://www.ico.la/old.html制作的48*48的.ico文件,才能最后显示图标。
pyinstaller -F helloworld.py --icon=C:\Users\hugleecool\Desktop\hello.ico
素材:
ios7图标:
http://www.shejidaren.com/ios7-icon-template.html
【注】:
编译的.exe,在.py脚本所在目录下创建的dist目录下能找到。
如果python是64位的,则.exe也只能在64位机下运行。所以我特意把python重装32位的。
很遗憾的是,生成的.exe不能在中文目录下运行,不能使用中文名。
另外一个打包生成可执行文件的程序:cx_Freeze可以。
参考crifan:
http://www.crifan.com/use_pyinstaller_to_package_python_to_single_executable_exe/