I wanna solution to this error when import tensorflow

AttributeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 import tensorflow as tf

File E:\anaconda\lib\site-packages\tensorflow_init_.py:37
34 import sys as _sys
35 import typing as _typing
—> 37 from tensorflow.python.tools import module_util as _module_util
38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.

File E:\anaconda\lib\site-packages\tensorflow\python_init_.py:37
29 # We aim to keep this file minimal and ideally remove completely.
30 # If you are adding a new file with @tf_export decorators,
31 # import it in modules_with_exports.py instead.
33 # go/tf-wildcard-import
34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
36 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
—> 37 from tensorflow.python.eager import context
39 # pylint: enable=wildcard-import
41 # Bring in subpackages.
42 from tensorflow.python import data

File E:\anaconda\lib\site-packages\tensorflow\python\eager\context.py:35
33 from tensorflow.python.client import pywrap_tf_session
34 from tensorflow.python.eager import executor
—> 35 from tensorflow.python.eager import monitoring
36 from tensorflow.python.framework import c_api_util
37 from tensorflow.python.framework import device as pydev

File E:\anaconda\lib\site-packages\tensorflow\python\eager\monitoring.py:24
22 from tensorflow.python import pywrap_tfe
23 from tensorflow.python.client import pywrap_tf_session
—> 24 from tensorflow.python.framework import c_api_util
25 from tensorflow.python.util import compat
26 from tensorflow.python.util.tf_export import tf_export

File E:\anaconda\lib\site-packages\tensorflow\python\framework\c_api_util.py:22
20 from tensorflow.core.framework import op_def_pb2
21 from tensorflow.python.client import pywrap_tf_session as c_api
—> 22 from tensorflow.python.util import compat
23 from tensorflow.python.util import tf_contextlib
26 class AlreadyGarbageCollectedError(Exception):

File E:\anaconda\lib\site-packages\tensorflow\python\util\compat.py:205
200 return as_bytes(path)
203 # Numpy 1.8 scalars don’t inherit from numbers.Integral in Python 3, so we
204 # need to check them specifically. The same goes from Real and Complex.
→ 205 integral_types = (_numbers.Integral, _np.integer)
206 tf_export(‘compat.integral_types’).export_constant(name, ‘integral_types’)
207 real_types = (_numbers.Real, _np.integer, _np.floating)

AttributeError: module ‘numpy’ has no attribute ‘integer’


Welcome to the Tensorflow Forum!

There appears to be a mismatch in versions between Tensorflow and Numpy.

What versions of Tensorflow and Numpy are you currently using?

Thank you!