用pip安装pyinstaller,然后执行pyinstaller.exe -F -i code.ico ttest1.py
PS:如果不想让程序运行完就退出cmd窗口,最后用os.system(“pause”)