【发布时间】:2020-07-08 20:00:19
【问题描述】:
我在导入 sklearn 时遇到这些错误。 ImportError 说它无法加载 libopenblasp-r0.3.5.dylib。我不知道为什么它没有加载。
我从其他建议创建符号链接仍然无法弄清楚。我使用 pip 在 macOS 中安装 scikit-learn。
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/sklearn/__init__.py", line 82, in <module>
from .base import clone
File "/usr/local/lib/python3.7/site-packages/sklearn/base.py", line 20, in <module>
from .utils import _IS_32BIT
File "/usr/local/lib/python3.7/site-packages/sklearn/utils/__init__.py", line 27, in <module>
from .fixes import np_version
File "/usr/local/lib/python3.7/site-packages/sklearn/utils/fixes.py", line 18, in <module>
import scipy.stats
File "/usr/local/lib/python3.7/site-packages/scipy/stats/__init__.py", line 367, in <module>
from .stats import *
File "/usr/local/lib/python3.7/site-packages/scipy/stats/stats.py", line 172, in <module>
import scipy.special as special
File "/usr/local/lib/python3.7/site-packages/scipy/special/__init__.py", line 641, in <module>
from ._ufuncs import *
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/scipy/special/_ufuncs.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.3.5.dylib
Referenced from: /usr/local/lib/python3.7/site-packages/scipy/special/_ufuncs.cpython-37m-darwin.so
Reason: image not found
酿造信息openblas
Optimized BLAS library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.6_1 (21 files, 120MB)
Poured from bottle on 2019-07-24 at 17:27:55
/usr/local/Cellar/openblas/0.3.9 (22 files, 119.7MB)
Poured from bottle on 2020-03-27 at 13:46:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openblas.rb
==> Dependencies
Required: gcc ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.
For compilers to find openblas you may need to set:
export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
For pkg-config to find openblas you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
【问题讨论】:
-
请提供
brew info openblas的输出。谢谢。 -
@sentence 添加了 brew 信息更新
-
您使用的是虚拟环境还是类似的东西? (顺便说一句,我的建议是只使用 Conda,它应该有助于这种情况)
标签: python python-3.x scikit-learn importerror openblas