用的是MacOS python3.11
刚刚下完numpy和scipy, 运行scipy.stats时发生如下错误
运行其他scipy例如scipy.integrate等都没问题
请问各位如何解决, 感谢帮助
Traceback (most recent call last):
File "", line 2, in
import scipy.stats
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/scipy/stats/__init__.py", line 485, in
from ._stats_py import *
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/scipy/stats/_stats_py.py", line 46, in
from . import distributions
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/scipy/stats/distributions.py", line 10, in
from . import _continuous_distns
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/scipy/stats/_continuous_distns.py", line 10302, in
b=np.inf)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/__init__.py", line 284, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'scipy.stats._boost'
https://www.osgeo.cn/scipy/reference/index.html 这个scipy官网里没有_boost 。 你的scipy既然import成功,查下里面是否有scipy.stats._boost
回答不易,求求您采纳点赞哦
报错“Attribute 'scipy.stats._boost' not found”提示您安装的SciPy版本与您安装的NumPy版本不兼容。
一种解决方案是尝试卸载并重新安装相同版本的 SciPy 和 NumPy。您可以使用 pip 安装特定版本的软件包,例如:
pip install scipy==1.4.1
pip install numpy==1.19.3
另一种解决方案是使用虚拟环境来管理包依赖性。这允许您为不同的项目安装不同版本的包,而不会相互干扰。您可以使用virtualenv或之类的工具conda来创建和管理虚拟环境。
确保您使用的是相同版本的 scipy 和 numpy ,并检查您是否有任何其他版本的 scipy 或 numpy 可能与您正在使用的版本冲突。
另外需要注意的是,scipy 1.22.0不支持python3.11,scipy 1.4.1支持python3.11,如果要使用python3.11,需要安装scipy 1.4.1或更高版本。