我导入的所有内容都会给我这个错误。
AttributeError:类型对象'numpy.ndarray'没有属性' array_function '
Tensorflow和chatterbot一直给我这个错误。我尝试卸载它们的不同版本,然后重新安装它们。我也尝试卸载并重新安装numpy,但奇怪的是,我仅在某些运行numpy的程序上遇到此错误。
这是完整的错误。
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/chatterbot/__init__.py", line 4, in <module>
from .chatterbot import ChatBot
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/chatterbot/chatterbot.py", line 2, in <module>
from chatterbot.storage import StorageAdapter
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/chatterbot/storage/__init__.py", line 1, in <module>
from chatterbot.storage.storage_adapter import StorageAdapter
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/chatterbot/storage/storage_adapter.py", line 3, in <module>
from chatterbot.tagging import PosHypernymTagger
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/chatterbot/tagging.py", line 3, in <module>
from chatterbot import utils
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/chatterbot/utils.py", line 4, in <module>
from nltk.corpus import wordnet
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/nltk/__init__.py", line 129, in <module>
from nltk.collocations import *
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/nltk/collocations.py", line 40, in <module>
from nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/nltk/metrics/__init__.py", line 16, in <module>
from nltk.metrics.scores import (
File "/home/zachary/anaconda3/envs/NLP/lib/python3.6/site-packages/nltk/metrics/scores.py", line 18, in <module>
from scipy.stats.stats import betai
File "/home/zachary/.local/lib/python3.6/site-packages/scipy/__init__.py", line 62, in <module>
from numpy import show_config as show_numpy_config
File "/home/zachary/.local/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/zachary/.local/lib/python3.6/site-packages/numpy/core/__init__.py", line 59, in <module>
from . import numeric
File "/home/zachary/.local/lib/python3.6/site-packages/numpy/core/numeric.py", line 3093, in <module>
from . import fromnumeric
File "/home/zachary/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 17, in <module>
from . import _methods
File "/home/zachary/.local/lib/python3.6/site-packages/numpy/core/_methods.py", line 158, in <module>
_NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'