TypeError: __init__() got an unexpected keyword argument 'serialized_options'

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29303759/article/details/83932891

更新TensorFlow引起的惨案。。。

忘了是因为什么原因,我更新了一波TensorFlow,然后在P本地Python中import TensorFlow时,就报出了这个错误。

网上的原因是说protobuf版本不对,采用

pip install -U protobuf

安装时,发现在我的电脑上的protobuf已经安装,所以没有什么反应。

我激活TensorFlow环境,使用Python,import TensorFlow,发现可以导入,不报错。

import protobuf,报错no module named protobuf.

然后在TensorFlow环境中卸载protobuf,发现protobuf版本号为3.2.0

使用pip install protobuf,安装了3.6.0版本的protobuf。

退出TensorFlow,发现protobuf的版本也为3.6.0.

本地Python和TensorFlow环境下均卸载protobuf3.6.0,安装protobuf3.2.0.

然而在本地Python中,还是出现了import TensorFlow 报错,还是之前的错,所以这样来看protobuf版本问题并没有起作用。

进一步查看,发现本地安装的TensorFlow版本为1.12.0,而TensorFlow环境下安装的TensorFlow版本为1.2.1.

在本地卸载1.12.0的TensorFlow,安装1.2.1的TensorFlow。

在cmd下import TensorFlow不报错,在Spyder中导入报错:NameError: name 'core' is not defined

重新导入的时候又报错:没有找到Python。

重启一下kernel,import TensorFlow成功。

总结一下:个人觉得还是TensorFlow版本错误的原因,可能是我刚开始又安装了TensorFlow,才导致这样的折腾。

猜你喜欢

转载自blog.csdn.net/qq_29303759/article/details/83932891