升级到tensorflow 2.0后导入tensorflow报错

After upgrading to tensorflow 2.0, I get the error to import tensorflow

大约一年前,我通过 anaconda 安装了 tensorflow。现在,我在 cmd 中使用以下行将 tensorflow 升级到 tensorflow 2.0.0-beta1:

conda update --all
pip install --upgrade tensorflow==2.0.0-beta1

安装成功加上最后的评论:

Successfully installed google-pasta-0.1.7 tb-nightly-1.14.0a20190603 tensorflow-2.0.0b1 tf-estimator-nightly-1.14.0.dev2019060501

但是当我导入 tensorflow 时出现这个错误:

import tensorflow

AttributeError: module 'pandas' has no attribute 'core'

你可以试试下面的命令

conda upgrade --all

如果你使用的是jupyter notebook,请重启本书然后尝试导入tensorflow

希望这对您有所帮助。

使用以下代码片段创建环境。
conda create -n myenv python=3.4
在此环境中安装包括 Tensorflow 在内的所有库,这样就不会有任何兼容性问题。 注意:当您根据您指定的 python 版本创建环境时,一些库是内置的。