tensorflow解决keras报错 “AlreadyExistsError: Another metric with the same name already exists.“

tensorflow解决keras报错 “AlreadyExistsError: Another metric with the same name already exists.“,第1张

tensorflow解决keras报错 “AlreadyExistsError: Another metric with the same name already exists.“

tensorflow解决keras报错 "AlreadyExistsError: Another metric with the same name already exists."
最近要用到keras的一些API,用conda install keras之后不起作用,然后uninstall之后用pip重新安装后报了这个错。

我的tensorflow是2.6,装的keras是2.7。

从字面意思看是已经安装了两个keras的冲突,这里搬运一下stackoverflow上的帖子原帖:

在tensorflow的release note里面写了这个问题:
https://github.com/tensorflow/tensorflow/releases/tag/v2.6.0

Keras been split into a separate PIP package (keras), and its code has been moved to the GitHub repositorykeras-team/keras. The API endpoints for tf.keras stay unchanged, but are now backed by the keras PIP package. The existing code in tensorflow/python/keras is a staled copy and will be removed in future release (2.7). Please remove any imports to tensorflow.python.keras and replace them with public tf.keras API instead.

意思就是keras代码移位了,需要用pip单独安装,但之前的keras还没移除。如果装了和tf版本不一致的keras就会somehow触发这个冲突,于是意识到keras版本装错了,用pip重装一下就好:

pip install keras==2.6.*

解决。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5491079.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存