当前位置:   article > 正文

记录下导入keras时的问题:tensorflow.python.eager和module ‘tensorflow.compat.v2‘ has no attribute ‘__internal__‘_has no attribute register load context

has no attribute register load context

1、tf版本要与keras版本对应,不然导入会出现错误import keras cannot import name ‘context’ from ‘tensorflow.python.eager’ (unknown location)
具体对应版本看这
tf与keras对应版本查询以及下载对应版本地址
2、就算版本对应了,import keras 还是报错
module ‘tensorflow.compat.v2‘ has no attribute ‘internal
搜索了一下,用 from tensorflow.compat.v1 import keras 完美解决

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/504322
推荐阅读
相关标签
  

闽ICP备14008679号