网上流传的解决方法大多是
pip uninstall tensorflow protobuf --yes
find $CONDA_PREFIX -name "tensorflow" | xargs -Ipkg rm -rfv pkg
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp36-cp36m-linux_x86_64.whl --no-cache-dir
不过我试了好几次都没有成功,还是要靠自己。。。
其实就是升级后有些依赖项没有升级,卸载又没卸载干净,导致重装也不行,这口锅要甩给pip,解决方法是卸载TensorFlow后,再打开Python看看自己还能不能引用tensorflow,如果可以,直接查看tf.__path__,去该目录下把名字带tensor的文件夹全删了(最好先运行pip uninstall tensorboard,然后把tensorboard的文件夹也删了,反正装tensorflow的时候会自动重装),然后再运行
pip install --ignore-installed tensorflow
重装一遍TensorFlow就好了。