Import Error: cannot import name ‘export_saved_model

2022-09-02 20:19:38 浏览数 (1)

代码语言:javascript复制
Using TensorFlow backend.
D:Anaconda installlibsite-packagestensorflowpythonframeworkdtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:Anaconda installlibsite-packagestensorflowpythonframeworkdtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:Anaconda installlibsite-packagestensorflowpythonframeworkdtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:Anaconda installlibsite-packagestensorflowpythonframeworkdtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:Anaconda installlibsite-packagestensorflowpythonframeworkdtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:Anaconda installlibsite-packagestensorflowpythonframeworkdtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):

  File "<ipython-input-3-1b08a8769e32>", line 1, in <module>
    from keras.models import Sequential

  File "D:Anaconda installlibsite-packageskeras__init__.py", line 3, in <module>
    from . import utils

  File "D:Anaconda installlibsite-packageskerasutils__init__.py", line 6, in <module>
    from . import conv_utils

  File "D:Anaconda installlibsite-packageskerasutilsconv_utils.py", line 9, in <module>
    from .. import backend as K

  File "D:Anaconda installlibsite-packageskerasbackend__init__.py", line 1, in <module>
    from .load_backend import epsilon

  File "D:Anaconda installlibsite-packageskerasbackendload_backend.py", line 90, in <module>
    from .tensorflow_backend import *

  File "D:Anaconda installlibsite-packageskerasbackendtensorflow_backend.py", line 5, in <module>
    import tensorflow as tf

  File "D:Anaconda installlibsite-packagestensorflow__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

  File "D:Anaconda installlibsite-packagestensorflowpython__init__.py", line 83, in <module>
    from tensorflow.python import keras

  File "D:Anaconda installlibsite-packagestensorflowpythonkeras__init__.py", line 26, in <module>
    from tensorflow.python.keras import activations

  File "D:Anaconda installlibsite-packagestensorflowpythonkerasactivations.py", line 24, in <module>
    from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object

  File "D:Anaconda installlibsite-packagestensorflowpythonkerasutils__init__.py", line 39, in <module>
    from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model

  File "D:Anaconda installlibsite-packagestensorflowpythonkerasutilsmulti_gpu_utils.py", line 22, in <module>
    from tensorflow.python.keras.engine.training import Model

  File "D:Anaconda installlibsite-packagestensorflowpythonkerasenginetraining.py", line 40, in <module>
    from tensorflow.python.keras.engine import network

  File "D:Anaconda installlibsite-packagestensorflowpythonkerasenginenetwork.py", line 39, in <module>
    from tensorflow.python.keras import saving

  File "D:Anaconda installlibsite-packagestensorflowpythonkerassaving__init__.py", line 33, in <module>
    from tensorflow.python.keras.saving.saved_model import export_saved_model

ImportError: cannot import name 'export_saved_model' from 'tensorflow.python.keras.saving.saved_model' (D:Anaconda installlibsite-packagestensorflowpythonkerassavingsaved_model__init__.py)

Try to reinstall tensorflow

代码语言:javascript复制
pip uninstall -y tensorflow
pip install tensorflow

0 人点赞