Import Error: cannot import name ‘export_saved_model

於小勇發表於2020-12-18
Using TensorFlow backend.
D:\Anaconda install\lib\site-packages\tensorflow\python\framework\dtypes.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 install\lib\site-packages\tensorflow\python\framework\dtypes.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 install\lib\site-packages\tensorflow\python\framework\dtypes.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 install\lib\site-packages\tensorflow\python\framework\dtypes.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 install\lib\site-packages\tensorflow\python\framework\dtypes.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 install\lib\site-packages\tensorflow\python\framework\dtypes.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 install\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils

  File "D:\Anaconda install\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils

  File "D:\Anaconda install\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K

  File "D:\Anaconda install\lib\site-packages\keras\backend\__init__.py", line 1, in <module>
    from .load_backend import epsilon

  File "D:\Anaconda install\lib\site-packages\keras\backend\load_backend.py", line 90, in <module>
    from .tensorflow_backend import *

  File "D:\Anaconda install\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf

  File "D:\Anaconda install\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\__init__.py", line 83, in <module>
    from tensorflow.python import keras

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\__init__.py", line 26, in <module>
    from tensorflow.python.keras import activations

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\activations.py", line 24, in <module>
    from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\utils\__init__.py", line 39, in <module>
    from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\utils\multi_gpu_utils.py", line 22, in <module>
    from tensorflow.python.keras.engine.training import Model

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\engine\training.py", line 40, in <module>
    from tensorflow.python.keras.engine import network

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\engine\network.py", line 39, in <module>
    from tensorflow.python.keras import saving

  File "D:\Anaconda install\lib\site-packages\tensorflow\python\keras\saving\__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 install\lib\site-packages\tensorflow\python\keras\saving\saved_model\__init__.py)

 

Try to reinstall tensorflow

pip uninstall -y tensorflow
pip install tensorflow

相關文章