解决 py2exe打包后,总是多显示一个DOS黑色窗口

setup.py:

  1. #!/usr/bin/env python
  2. # coding=utf-8
  3. from distutils.core import setup
  4. import py2exe
  5. setup(
  6. description = 'software',
  7. version = '0.0.1',
  8. console=[{"script": "main.py", "icon_resources": [(1, "icon.ico")]}],
  9. options = {
  10. 'py2exe': {
  11. 'compressed': 1,
  12. 'optimize': 2,
  13. 'bundle_files': 2
  14. }
  15. }
  16. )

其中把 console 更改为 windows 即可,重新打包

  1. console=[{"script": "main.py", "icon_resources": [(1, "icon.ico")]}],
  1. windows=[{"script": "main.py", "icon_resources": [(1, "icon.ico")]}],

你可能感兴趣的:(python)