gpt4 book ai didi

python - 无法导入 numpy : AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

转载 作者:太空宇宙 更新时间:2023-11-03 15:37:14 24 4
gpt4 key购买 nike

我正在尝试导入 numpy 但出现以下错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-3-38d4b0363d82> in <module>()
----> 1 import pandas

/home/oto/.local/lib/python3.6/site-packages/pandas/__init__.py in <module>()
11 for dependency in hard_dependencies:
12 try:
---> 13 __import__(dependency)
14 except ImportError as e:
15 missing_dependencies.append(dependency)

/home/oto/.local/lib/python3.6/site-packages/numpy/__init__.py in <module>()
140 from . import _distributor_init
141
--> 142 from . import core
143 from .core import *
144 from . import compat

/home/oto/.local/lib/python3.6/site-packages/numpy/core/__init__.py in <module>()
57 from . import numerictypes as nt
58 multiarray.set_typeDict(nt.sctypeDict)
---> 59 from . import numeric
60 from .numeric import *
61 from . import fromnumeric

/home/oto/.local/lib/python3.6/site-packages/numpy/core/numeric.py in <module>()
3091 from .umath import *
3092 from .numerictypes import *
-> 3093 from . import fromnumeric
3094 from .fromnumeric import *
3095 from . import arrayprint

/home/oto/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py in <module>()
15 from . import numerictypes as nt
16 from .numeric import asarray, array, asanyarray, concatenate
---> 17 from . import _methods
18
19 _dt_ = nt.sctype2char

/home/oto/.local/lib/python3.6/site-packages/numpy/core/_methods.py in <module>()
156 )
157
--> 158 _NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
159
160 def _array_function(self, func, types, args, kwargs):

AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

如何解决这个问题?

最佳答案

我遇到了同样的问题。就跑

rm -rf /home/oto/.local/lib/python3.6/site-packages/numpy*

pip3 install numpy

它对我有用。

关于python - 无法导入 numpy : AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54176755/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com