Pydev Console中文提示乱码的问题

本文介绍了解决Unicode乱码的方法,包括如何使用Python处理特殊Unicode字符串,并调整Pydev的默认编码为UTF-8来避免乱码问题。

1、 像这样的规则内容请这样处理"\u305d\u3093\u306a\u306b"style unicode string :

print str.decode("unicode_escape")#decode"\u305d\u3093\u306a\u306b"style unicode string  

2、Unicode完全乱码症状的解决,主要要把Pydev的默认编码调整成UTF-8,调整方法比较麻烦参看

 

 http://blog.ianbicking.org/illusive-setdefaultencoding.html

http://stackoverflow.com/questions/3023972/printing-unicode-in-eclipse-pydev-console-and-in-idle

C:\Users\52945\AppData\Local\Programs\Python\Python311\python.exe "C:\Program Files\JetBrains\PyCharm 2021.3.3\plugins\python\helpers\pydev\pydevconsole.py" --mode=client --port=2972 ------------------------------------------------------------------------------- pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute) pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints. pydev debugger: Related bug: http://bugs.python.org/issue1666807 ------------------------------------------------------------------------------- import sys; print('Python %s on %s' % (sys.version, sys.platform)) sys.path.extend(['D:\\PyLib', 'D:/PyLib']) Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.14.0 -- An enhanced Interactive Python. Type '?' for help. PyDev console: using IPython 8.14.0 Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 runfile('D:/PyLib/C 参数获取/2、期货数据获取/期货数据获取测试.py', wdir='D:/PyLib/C 参数获取/2、期货数据获取') Traceback (most recent call last): File "C:\Users\52945\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\core\interactiveshell.py", line 3508, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-76c1628e4686>", line 1, in <module> runfile('D:/PyLib/C 参数获取/2、期货数据获取/期货数据获取测试.py', wdir='D:/PyLib/C 参数获取/2、期货数据获取') File "C:\Program Files\JetBrains\PyCharm 2021.3.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\JetBrains\PyCharm 2021.3.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+
03-18
E:\help\数据预处理代码\解释器\新建文件夹\Scripts\python.exe "D:/研究生软件/所需软件/py/JetBrains/Pycharm Pro 2023/Pycharm Pro 2023/PyCharm 2023.1/plugins/python/helpers/pydev/pydevconsole.py" --mode=client --host=127.0.0.1 --port=61632 E:\help\数据预处理代码\解释器\新建文件夹\Lib\site-packages\IPython\core\interactiveshell.py:889: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. warn( import sys; print('Python %s on %s' % (sys.version, sys.platform)) sys.path.extend(['E:\\help\\数据预处理代码\\YOLOv8-DeepSORT-Object-Tracking-main']) Python 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.12.2 -- An enhanced Interactive Python. Type '?' for help. PyDev console: using IPython 8.12.2 Python 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)] on win32 runfile('E:\\help\\数据预处理代码\\YOLOv8-DeepSORT-Object-Tracking-main\\ultralytics\\yolo\\v8\\toushi.py', wdir='E:\\help\\数据预处理代码\\YOLOv8-DeepSORT-Object-Tracking-main\\ultralytics\\yolo\\v8') E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 21407 (\N{CJK UNIFIED IDEOGRAPH-539F}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 22987 (\N{CJK UNIFIED IDEOGRAPH-59CB}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 35270 (\N{CJK UNIFIED IDEOGRAPH-89C6}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 39057 (\N{CJK UNIFIED IDEOGRAPH-9891}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 24103 (\N{CJK UNIFIED IDEOGRAPH-5E27}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 36879 (\N{CJK UNIFIED IDEOGRAPH-900F}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 21464 (\N{CJK UNIFIED IDEOGRAPH-53D8}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 25442 (\N{CJK UNIFIED IDEOGRAPH-6362}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 32467 (\N{CJK UNIFIED IDEOGRAPH-7ED3}) missing from font(s) DejaVu Sans. plt.tight_layout() E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py:71: UserWarning: Glyph 26524 (\N{CJK UNIFIED IDEOGRAPH-679C}) missing from font(s) DejaVu Sans. plt.tight_layout() D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 21407 (\N{CJK UNIFIED IDEOGRAPH-539F}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 22987 (\N{CJK UNIFIED IDEOGRAPH-59CB}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 35270 (\N{CJK UNIFIED IDEOGRAPH-89C6}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 39057 (\N{CJK UNIFIED IDEOGRAPH-9891}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 24103 (\N{CJK UNIFIED IDEOGRAPH-5E27}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 36879 (\N{CJK UNIFIED IDEOGRAPH-900F}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 21464 (\N{CJK UNIFIED IDEOGRAPH-53D8}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 25442 (\N{CJK UNIFIED IDEOGRAPH-6362}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 32467 (\N{CJK UNIFIED IDEOGRAPH-7ED3}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py:68: UserWarning: Glyph 26524 (\N{CJK UNIFIED IDEOGRAPH-679C}) missing from font(s) DejaVu Sans. FigureCanvasAgg.draw(self) Traceback (most recent call last): File "E:\help\数据预处理代码\解释器\新建文件夹\Lib\site-packages\IPython\core\interactiveshell.py", line 3508, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-9732e1746763>", line 1, in <module> runfile('E:\\help\\数据预处理代码\\YOLOv8-DeepSORT-Object-Tracking-main\\ultralytics\\yolo\\v8\\toushi.py', wdir='E:\\help\\数据预处理代码\\YOLOv8-DeepSORT-Object-Tracking-main\\ultralytics\\yolo\\v8') File "D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:\help\数据预处理代码\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\toushi.py", line 72, in <module> plt.show() File "E:\help\数据预处理代码\解释器\新建文件夹\Lib\site-packages\matplotlib\pyplot.py", line 614, in show return _get_backend_mod().show(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 29, in __call__ manager.show(**kwargs) File "D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 112, in show self.canvas.show() File "D:\研究生软件\所需软件\py\JetBrains\Pycharm Pro 2023\Pycharm Pro 2023\PyCharm 2023.1\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 73, in show buffer = self.tostring_rgb() ^^^^^^^^^^^^^^^^^ AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'
最新发布
08-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值