setup_exe.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. '''
  2. py2exe打包成exe
  3. linux使用PyInstaller
  4. '''
  5. from distutils.core import setup
  6. import py2exe
  7. import sys
  8. # this allows to run it with a simple double click.
  9. sys.argv.append('py2exe')
  10. py2exe_options = {
  11. "includes": ["sip"], # 如果打包文件中有PyQt代码,则这句为必须添加的
  12. "dll_excludes": ["MSVCP90.dll", ], # 这句必须有,不然打包后的程序运行时会报找不到MSVCP90.dll,如果打包过程中找不到这个文件,请安装相应的库
  13. "compressed": 1,
  14. "optimize": 2,
  15. "ascii": 0,
  16. "bundle_files": 1, # 关于这个参数请看第三部分中的问题(2)
  17. }
  18. setup(
  19. name='PyQt Demo',
  20. version='1.0',
  21. windows=['file_spider/pdffile_client.py'], # 括号中更改为你要打包的代码文件名
  22. data_files=[("",
  23. [r"C:\Software\Python\Python34\Lib\site-packages\PyQt5\libEGL.dll"]),
  24. ("platforms",
  25. [r"C:\Software\Python\Python34\Lib\site-packages\PyQt5\plugins\platforms\qwindows.dll"])],
  26. zipfile=None,
  27. options={'py2exe': py2exe_options}
  28. )