在我调用numpy时,有如下报错(我使用的是python3.9.2)
Error importing numpy: you should not try to
import numpy from its source directory;
please exit the numpy source tree, and relaunch your python interpreter from there.
Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
基于以上问题,我打算从两步入手:
1、numpy与python版本不匹配问题
解决参考我之前的文章Python使用numpy报错问题解决方案
具体python包与其版本的匹配要求,可参考:Archived: Unofficial Windows Binaries for Python Extension Packages
首先卸载自己安装却不能用的包:
pip uninstall packagename
然后下载对应版本的包:
pip install --default-timeout=100000 numpy==1.22.4
在进行完上述操作后, 可再次尝试运行python文件。如果出现:
Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
那么我们就需要安装Blas 的依赖项 ,参考这篇大佬文章ibcblas.so.3:cannot:
2、安装Blas 的依赖项
sudo apt-get install libatlas-base-dev
最后再进行测试,成功运行,如下图所示: