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

2024-05-28 20:23:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从tensorflow timeseries contrib运行一个示例代码,但是我得到了这个错误。

AttributeError: module 'tensorflow.python.pywrap_tensorflow' has no attribute 'TFE_Py_RegisterExceptionClass'

我在用水蟒。当前环境是Python3.5和tensorflow 1.2.1。也试过TF1.3,但没什么变化。

下面是我试图运行的代码: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/timeseries/examples/predict.py

我在谷歌上找不到关于这个问题的任何信息。

我试图开发一些时间序列预测,我想使用最后可用的资源。谢谢。


Tags: no代码py示例tensorflow错误attributecontrib
1条回答
网友
1楼 · 发布于 2024-05-28 20:23:39

正如Conan.Net所写:

I tried to remove/clean some environments from anaconda and install all again and it work this time.

这个解决方案对我也有效,所以虽然不理想,但它能解决问题。如果您使用的是anaconda,则在安装某些软件包,然后删除它们(例如tensorflow与tensorflow gpu)时可能会发生这种情况,这会使某些依赖关系挂起。在我的案例中,我使用了:

conda remove --name py2_tf_gpu --all

那么

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

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

相关问题 更多 >

    热门问题