Python3 UnicodeDecodeError: ‘ASCII’ codec can’t decode byte 0x90 in position 614: ordinal not in
directory
To solve the problem
To solve the process
The solution
To solve the problem
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0x90 in position 614: ordinal not in range(128)
To solve the process
1. Recently, I was working on a deep learning project. When calling files on GitHub, I wanted to use mnist_loader’s data set, but UnicodeDecodeError occurred after running: ‘ascii’ codec can’t decode byte 0x90 in position 614: ordinal not in range(128)
2, so, the author on all kinds of Baidu ah, a variety of degrees, at home and abroad, but the answer almost all have a kind, is to add the following code
3, However, the author in Python various join, various attempts, but also changed utf8 to GBK tried several times, again this error, I go to go!
4. Name reload ‘is not defined in Python 3.x, name reload’ is not defined in Python 3.x
import importlib
importlib.reload(sys)
Copy the code
Python 3 is a utF8 encoding by default. Python 2 is different from Python 3. More bikes? What bike? Ahhhhh!
5, so, the author fell into meditation, that is, fell asleep, ha ha, joke, continue to Google, Baidu, until found the following sentence,
God pays off to those who wait, ha ha, finally changed, thank you little dream, thank little dream, this kind brother, will
training_data, validation_data, test_data = cPickle.load(f)
Training_data, validation_data, test_data = cpickle. load(f,encoding=’bytes’)
Haha, success! Done! Efforts are always fruitful, continue to work hard!
The solution
Training_data, validation_data, test_DATA = cpickle.load (f) change training_data, validation_data, Test_data = cpickle. load(f,encoding=’bytes’)