TensorFlow 升级之后出现:
ImportError Traceback (most recent call last)
<ipython-input-1-64156d691fe5> in <module>()
----> 1 import tensorflow as tf
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py in <module>()
20
21 # pylint: disable=g-bad-import-order
---> 22 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
23
24 try:
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py in <module>()
79 # Bring in subpackages.
80 from tensorflow.python import data
---> 81 from tensorflow.python import keras
82 from tensorflow.python.feature_column import feature_column_lib as feature_column
83 from tensorflow.python.layers import layers
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\__init__.py in <module>()
22 from __future__ import print_function
23
---> 24 from tensorflow.python.keras import activations
25 from tensorflow.python.keras import applications
26 from tensorflow.python.keras import backend
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\activations\__init__.py in <module>()
20
21 # Activation functions.
---> 22 from tensorflow.python.keras._impl.keras.activations import elu
23 from tensorflow.python.keras._impl.keras.activations import hard_sigmoid
24 from tensorflow.python.keras._impl.keras.activations import linear
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\_impl\keras\__init__.py in <module>()
19 from __future__ import print_function
20
---> 21 from tensorflow.python.keras._impl.keras import activations
22 from tensorflow.python.keras._impl.keras import applications
23 from tensorflow.python.keras._impl.keras import backend
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\_impl\keras\activations.py in <module>()
21 import six
22
---> 23 from tensorflow.python.keras._impl.keras import backend as K
24 from tensorflow.python.keras._impl.keras.utils.generic_utils import deserialize_keras_object
25 from tensorflow.python.layers.base import Layer
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\_impl\keras\backend.py in <module>()
36 from tensorflow.python.framework import sparse_tensor
37 from tensorflow.python.framework import tensor_util
---> 38 from tensorflow.python.layers import base as tf_base_layers
39 from tensorflow.python.ops import array_ops
40 from tensorflow.python.ops import clip_ops
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\layers\base.py in <module>()
23 from tensorflow.python.framework import dtypes
24 from tensorflow.python.framework import ops
---> 25 from tensorflow.python.keras.engine import base_layer
26 from tensorflow.python.ops import variable_scope as vs
27 from tensorflow.python.ops import variables as tf_variables
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\__init__.py in <module>()
21 # TODO (fchollet): Remove hourglass imports once external code is done importing
22 # non-public APIs.
---> 23 from tensorflow.python.keras.engine.base_layer import InputSpec
24 from tensorflow.python.keras.engine.base_layer import Layer
25 from tensorflow.python.keras.engine.input_layer import Input
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in <module>()
31 from tensorflow.python.framework import tensor_shape
32 from tensorflow.python.framework import tensor_util
---> 33 from tensorflow.python.keras import backend
34 from tensorflow.python.keras import constraints
35 from tensorflow.python.keras import initializers
~\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\keras\backend\__init__.py in <module>()
20
21 # pylint: disable=redefined-builtin
---> 22 from tensorflow.python.keras._impl.keras.backend import abs
23 from tensorflow.python.keras._impl.keras.backend import all
24 from tensorflow.python.keras._impl.keras.backend import any
ImportError: cannot import name 'abs'
在 GitHub 中按照如下方式进行卸载重装:
pip uninstall tensorflow tensorflow-gpu protobuf --yes
pip install --ignore-installed --upgrade --ignore-installed tensorflow-gpu
依然出现上述错误!!!
大家有遇到这种情况每?
Zach 2018-8-14 11:07:02