AttributeError: 模块“tensorflow.python.pywrap_tensorflow”没有属性“TFE_Py_RegisterExceptionClass”

Con*_*Net 6 python machine-learning time-series tensorflow recurrent-neural-network

我正在尝试使用可用的最新资源开发一些时间序列序列预测。为此,我确实检查了 TensorFlow 时间序列中的示例代码,但我收到了这个错误:

AttributeError: module 'tensorflow.python.pywrap_tensorflow' has no attribute 'TFE_Py_RegisterExceptionClass'
Run Code Online (Sandbox Code Playgroud)

我正在使用蟒蛇。当前环境是 Python 3.5 和 TensorFlow 1.2.1。还尝试了 TensorFlow 1.3,但没有任何改变。

这是我试图运行的代码。我在 Google 上没有找到与该问题相关的任何有用信息。关于如何解决它的任何想法?

ntg*_*ntg 0

正如 Conan.Net 所写:

我尝试从 anaconda 中删除/清理一些环境并再次安装所有环境,这次它可以工作。

这个解决方案也对我有用,所以虽然不理想,但它可以解决问题。如果您使用的是 anaconda,则在安装某些软件包然后删除它们(例如tensorflow 与tensorflow-gpu)时可能会发生这种情况,从而导致某些依赖项悬而未决。就我而言,我使用了:

conda remove --name py2_tf_gpu --all
Run Code Online (Sandbox Code Playgroud)

然后

conda create --name py2_tf_gpu python=2 anaconda pandas numpy scipy jupyter 
source activate py2_tf_gpu
pip install --ignore-installed --upgrade tensorflow-gpu
Run Code Online (Sandbox Code Playgroud)

pip 目前安装了比 anaconda(1.3) 更高的版本(1.4),我需要它。