UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 614: ordinal not in range(128)

这个问题的解决要看具体的python版本:python2和python3不一样。

在python2中:在代码前端加上以下代码:

               import sys

               reload(sys)

               sys.setdefaultencoding('uft8')

亲测可用,但要注意此代码一定要加载到最前端,否则无效。

在python3中,只是加入python2中的代码之后,又会出现这样的错误:NameError:name 'relload' is not defined,要将

                     train_set, valid_set, test_set = pickle.load(f)

                      改成

                      train_set, valid_set, test_set = pickle.load(f, encoding='bytes')

参考博客:https://blog.csdn.net/qq_41185868/article/details/79039604

                  https://blog.csdn.net/jewelsu/article/details/78683024

猜你喜欢

转载自blog.csdn.net/c_daofeng/article/details/81162890