UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

import tensorflow as tf
import matplotlib.pyplot as py

image=tf.gfile.FastGFile("D:\\Coder\\tensorflow\\01.png",'r').read()

程序报错为:UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

只需将‘r'改为’rb'即可

文本读取错误的时候将Notepad++更改文本格式也可以处理

猜你喜欢

转载自blog.csdn.net/u012785169/article/details/86663625