之前安装的比较早,版本是1.6.0,最近想要升级,于是参考网上链接进行升级
pip install --upgrade --ignore-installed tensorflow
升级之后运行出现了模块导入错误
ImportError: cannot import name abs
网上搜索是因为和protobuf版本不兼容造成的,因此需要卸载重新安装
pip uninstall tensorflow protobuf --yes
pip install --ignore-installed --upgrade --ignore-installed tensorflow
题外话,
如果之前基于 Anaconda 的安装的话,在升级之前,先对原来的环境进行备份,操作比较好。
复制某个环境
conda create --name new_env_name --clone old_env_name
升级参考链接:https://blog.csdn.net/lwplwf/article/details/75151050
解决参考链接:https://github.com/tensorflow/probability/issues/46