我試圖下載BVLC訓練模式,我堅持了這個錯誤「UTF-8」編解碼器不能解碼字節0x80的
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 110: invalid start byte
我想這是因爲以下功能(complete code )
# Closure-d function for checking SHA1.
def model_checks_out(filename=model_filename, sha1=frontmatter['sha1']):
with open(filename, 'r') as f:
return hashlib.sha1(f.read()).hexdigest() == sha1
任何想法如何解決這個問題?
錯誤消息是很清楚。您的文件根本不是UTF8,或者它已損壞。 – usr2564301
這就是當我嘗試打印'f' '<_io.TextIOWrapper name ='models/bvlc_reference_caffenet/bvlc_reference_caffenet時得到的結果。caffemodel'mode ='r'encoding ='utf8'>' –
有趣。那麼當你明確指定文件編碼時會發生什麼?像'open(filename,'r',encoding ='utf8')''? –