当前位置: 代码迷 >> 综合 >> AttributeError: module ‘tensorflow‘ has no attribute ‘convert_to_tensor‘
  详细解决方案

AttributeError: module ‘tensorflow‘ has no attribute ‘convert_to_tensor‘

热度:33   发布时间:2024-01-19 10:43:39.0

今天在调试GOTURN的代码的时候,Console丢了一个错误出来:

AttributeError: module 'tensorflow' has no attribute 'convert_to_tensor'

开始看到这个error的时候,不明所以,难道tensorflow没有这个函数吗?

查了一下,tensorflow是有这个函数的,于是直接把问题copy,搜了一下,找到了解决方法:

卸载tensorflow

pip uninstall tensorflow

重装tensorflow

pip install tensorflow==1.2.0

注:我是用的tensorflow1.2的版本,你根据自己使用的版本修改即可.

此类问题有时候是因为模块确实没有你写的属性,如果排除了这个原因,一般就是该模块抽风了,重装就完事了.(重装大法好,嘻嘻)

  相关解决方案