errors_impl.AlreadyExistsError: Another metric with the same name already exists.

errors_impl.AlreadyExistsError: Another metric with the same name already exists.

今天在导包keras包时,总是报上面这个错误,说已经keras文件名重复

import keras也不行。

from tensorflow import keras
from tensorflow.keras.applications.vgg16 import VGG16

网上查询各种方法,最后检查我安装的tensorflow-gpu 2.6.0,默认keras 2.8.0

把keras2.8.0版本降到2.6.0解决

(tensorflowgpu) C:\Windows\system32>pip uninstall keras
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
Found existing installation: keras 2.8.0
Uninstalling keras-2.8.0:
  Would remove:
    c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages\keras-2.8.0.dist-info\*
    c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages\keras\*
Proceed (Y/n)? y
  Successfully uninstalled keras-2.8.0

重新安装


(tensorflowgpu) C:\Windows\system32>pip install keras==2.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting keras==2.6.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5a/38/04d9b7fb53acdf861df2c4505fa96b06c779817a511e94b8882d284ba360/keras-2.6.0-py2.py3-none-any.whl (1.3 MB)
     |████████████████████████████████| 1.3 MB 501 kB/s
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
Installing collected packages: keras
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
Successfully installed keras-2.6.0
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)
WARNING: Ignoring invalid distribution -eras (c:\programdata\anaconda3\envs\tensorflowgpu\lib\site-packages)

(tensorflowgpu) C:\Windows\system32>

参考

https://blog.csdn.net/mmdbhs/article/details/121169727icon-default.png?t=M276https://blog.csdn.net/mmdbhs/article/details/121169727

你可能感兴趣的:(Python,keras)