1个月前TensorFlow工作良好。现在我甚至不能导入它。我删除了python和anaconda以及基本环境文件。我重新安装了anaconda,并使用anaconda导航器安装TensorFlow。每次我尝试导入TensorFlow时,我都会在anaconda提示符中得到这个错误。
(base) C:UsersPrakhar Sharma>python
Python 3.8.10 (default, May 19 2021, 13:12:57) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:Anacondalibsite-packagestensorflow__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "D:Anacondalibsite-packagestensorflowpython__init__.py", line 47, in <module>
from tensorflow.python import keras
File "D:Anacondalibsite-packagestensorflowpythonkeras__init__.py", line 27, in <module>
from tensorflow.python.keras import models
File "D:Anacondalibsite-packagestensorflowpythonkerasmodels.py", line 26, in <module>
from tensorflow.python.keras.engine import functional
File "D:Anacondalibsite-packagestensorflowpythonkerasenginefunctional.py", line 38, in <module>
from tensorflow.python.keras.engine import training as training_lib
File "D:Anacondalibsite-packagestensorflowpythonkerasenginetraining.py", line 50, in <module>
from tensorflow.python.keras.engine import data_adapter
File "D:Anacondalibsite-packagestensorflowpythonkerasenginedata_adapter.py", line 60, in <module>
import pandas as pd # pylint: disable=g-import-not-at-top
File "D:Anacondalibsite-packagespandas__init__.py", line 22, in <module>
from pandas.compat import (
File "D:Anacondalibsite-packagespandascompat__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "D:Anacondalibsite-packagespandascompatnumpy__init__.py", line 7, in <module>
from pandas.util.version import Version
File "D:Anacondalibsite-packagespandasutil__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "D:Anacondalibsite-packagespandasutil_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "D:Anacondalibsite-packagespandas_libs__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas_libsinterval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
>>>
还有,我不知道为什么上面写着MSC v.1916 64 bit (AMD64)
。我用的是Intel i5,并且下载了正确的安装程序。我有TensorFlow 2.3.0。查看此片段了解更多细节
我已经使用conda update -all
来获取最新的更新。
问题与numpy版本有关。安装最新版本的numpy
pip uninstall numpy
pip install numpy