文章目录 原因 str 前有u 情形一 非pickle场景下 情形二 pickle场景下 原因 python在2.x与3.x版本之间常常会因为字符编码的不融洽的问题出现UnicodeDecodeError这个问题。 str 前有u 利用str.encode进行解决 string = u'anomaly' print(string.encode('utf-8')) # 'anomaly' 更具体的内容参考&#x