面对与TensorFlow一起使用的问题。
python
from __future__ import absolute_import, division, print_function, unicode_literals
import pathlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
print(tf.__version__)
运行此简单脚本,出现以下错误-
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-11-e2c1176b26ef> in <module>()
7 import seaborn as sns
8
----> 9 import tensorflow as tf
10 from tensorflow import keras
11 from tensorflow.keras import layers
/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py in <module>()
26
27 # pylint: disable=g-bad-import-order
---> 28 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
29 from tensorflow.python.tools import module_util as _module_util
30
/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py in <module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
ImportError: cannot import name pywrap_tensorflow
已经尝试升级pip
和TensorFlow
。但这不再影响...任何人都可以帮我解决问题