setup.py:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env python
# coding=utf-8
from distutils.core import setup
import py2exe
setup(
description = 'software' ,
version = '0.0.1' ,
console = [{ "script" : "main.py" , "icon_resources" : [( 1 , "icon.ico" )]}],
options = {
'py2exe' : {
'compressed' : 1 ,
'optimize' : 2 ,
'bundle_files' : 2
}
}
)
|
其中把 console 更改为 windows 即可,重新打包
1
|
console = [{ "script" : "main.py" , "icon_resources" : [( 1 , "icon.ico" )]}],
|
1
|
windows = [{ "script" : "main.py" , "icon_resources" : [( 1 , "icon.ico" )]}],
|
以上这篇解决py2exe打包后,总是多显示一个dos黑色窗口的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/JUST_DO_1122/article/details/78435723