故障说明
![Pyinstaller打包后 print颜色乱码](https://www.blissfulcandy.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
![Pyinstaller打包后 print颜色乱码](https://www.blissfulcandy.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
解决方案
- 来源: https://blog.csdn.net/qq_39648255/article/details/120704826
- 方案:脚本内加入如下代码
import colorama
colorama.init(autoreset=True)
![Pyinstaller打包后 print颜色乱码](https://www.blissfulcandy.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
3. 红色代码
if validity_dic['zip']:
print('已安装 360压缩:检测通过!')
else:
print('已安装 360压缩:\033[1;31m检测失败!\033[0m')
颜色代码
# -*- coding:utf-8 -*-
print("\033[1;30m 字体颜色:白色\033[0m")
print("\033[1;31m 字体颜色:红色\033[0m")
print("\033[1;32m 字体颜色:深黄色\033[0m")
print("\033[1;33m 字体颜色:浅黄色\033[0m")
print("\033[1;34m 字体颜色:蓝色\033[0m")
print("\033[1;35m 字体颜色:淡紫色\033[0m")
print("\033[1;36m 字体颜色:青色\033[0m")
print("\033[1;37m 字体颜色:灰色\033[0m")
print("\033[1;38m 字体颜色:浅灰色\033[0m")
print("背景颜色:白色 \033[1;40m \033[0m")
print("背景颜色:红色 \033[1;41m \033[0m")
print("背景颜色:深黄色 \033[1;42m \033[0m")
print("背景颜色:浅黄色 \033[1;43m \033[0m")
print("背景颜色:蓝色 \033[1;44m \033[0m")
print("背景颜色:淡紫色 \033[1;45m \033[0m")
print("背景颜色:青色 \033[1;46m \033[0m")
print("背景颜色:灰色 \033[1;47m \033[0m")
![Pyinstaller打包后 print颜色乱码](https://www.blissfulcandy.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
本文为原创文章,撰写发布者:GSolaris,转载请注明出处:https://www.blissfulcandy.com/index.php/2023/07/19/pyinstallercolorama/