【发布时间】:2021-07-06 22:42:57
【问题描述】:
我无法解决下面提到的错误。你能帮忙吗?我尝试了各种方法。我尝试过的任何解决方案都无法解决此错误。我在网上看讲座视频。他们不会在我观看的视频内容中遇到此类错误。我是 Tensorflow 软件的新手。如果有资源可以推荐给我,能否具体说明一下?
这些文件是从“Jupyter Notebook”准备的。
附加文件
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
from IPython.display import display
from tensorflow.keras.layers import Dense, Flatten, Conv2D
from tensorflow.keras import Model
错误代码
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-5b72732c4197> in <module>
4 import sys
5 import tarfile
----> 6 import tensorflow as tf
7 import zipfile
8
~\anaconda3\lib\site-packages\tensorflow-2.6.0rc0-py3.8-win-amd64.egg\tensorflow\__init__.py in <module>
39 import sys as _sys
40
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
43
~\anaconda3\lib\site-packages\tensorflow-2.6.0rc0-py3.8-win-amd64.egg\tensorflow\python\__init__.py in <module>
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
39
---> 40 from tensorflow.python.eager import context
41 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
42
~\anaconda3\lib\site-packages\tensorflow-2.6.0rc0-py3.8-win-amd64.egg\tensorflow\python\eager\context.py in <module>
30 import six
31
---> 32 from tensorflow.core.framework import function_pb2
33 from tensorflow.core.protobuf import config_pb2
34 from tensorflow.core.protobuf import rewriter_config_pb2
~\anaconda3\lib\site-packages\tensorflow-2.6.0rc0-py3.8-win-amd64.egg\tensorflow\core\framework\function_pb2.py in <module>
5 import sys
6 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
----> 7 from google.protobuf import descriptor as _descriptor
8 from google.protobuf import message as _message
9 from google.protobuf import reflection as _reflection
ModuleNotFoundError: No module named 'google.protobuf'
我在下面指定了“pip”文件
!pip install --upgrade tensorflow
!pip install tf_slim
!pip install crcmod
!pip install opencv-python
!pip install dm-tree
!pip install importlib-resources
!pip install promise
!pip install tensorflow-metadata
!pip install google-api-core==1.21.0
!pip install google-auth-httplib2==0.1.0
!pip install uritemplate==3.0.0
!pip install avro-python3!==1.8.1
!pip install protobuf
!pip install grpcio
!pip install grpcio-tools
!pip3 install six numpy wheel
!pip3 install keras_applications==1.0.6 --no-deps
!pip3 install keras_preprocessing==1.0.5 --no-deps
!pip install bazel
!pip install ipython
!pip install google
!pip install protobuf
!pip install tensorflow as tf
!pip install tensorflow-object-detection-api==0.1.1
【问题讨论】:
标签: python tensorflow jupyter