导入错误:无法从部分初始化的模块“keras. saving.legacy.serialization”导入名称“deserialize_keras_object”

问题描述 投票:0回答:1

我的代码有问题,我需要帮助来解决它。我有张量流版本2.12.0。

import tensorflow as tf

(train_image, train_labels), (test_image, test_labels) = tf.keras.datasets.mnist.load_data()

我有:

ImportError: cannot import name 'deserialize_keras_object' from partially initialized module 'keras.saving.legacy.serialization' (most likely due to a circular import) (/home/jude/anaconda3/envs/tf/lib/python3.11/site-packages/keras/saving/legacy/serialization.py)

这是什么以及如何解决这个问题?

python tensorflow machine-learning keras dataset
1个回答
0
投票

pip 卸载张量流 pip 安装tensorflow==2.12.0

从tensorflow.keras.datasets导入mnist (train_image, train_labels), (test_image, test_labels) = mnist.load_data()

© www.soinside.com 2019 - 2024. All rights reserved.