我想运行一段代码。它是使用 Tensorflow 用 Python3 编写的。我可以运行代码,但是当代码运行时,我尝试在单独的 Anaconda Prompt 中运行另一个代码并进行一些更改。然后我停止了代码。现在,当我尝试再次运行类似的代码而不进行任何更改时,它会给出以下错误:
AttributeError: 'str' object has no attribute 'decode'
Run Code Online (Sandbox Code Playgroud)
该错误引用了tensorflow\python\keras包,如下所示:
hdf5_format.py. line 711, in load_weights_from_hdf5_group
original_keras_version = f.attrs['keras_version'].decode('utf8')
Run Code Online (Sandbox Code Playgroud)
这是我的代码的一些部分,它引发了错误:
self.encoder.load_weights(weights_file, by_name = True)
Run Code Online (Sandbox Code Playgroud)
我关闭程序并重新打开它,但错误仍然存在。
有谁知道如何解决它?