查看: 1536|回复: 4

A BLAS error occurred in the Python SciPy

[复制链接]

4

主题

11

帖子

39

积分

新手上路

Rank: 1

积分
39
发表于 2018-9-18 18:29:29 | 显示全部楼层 |阅读模式
  1. umpy.distutils.system_info.BlasNotFoundError:
  2.     Blas (http://www.netlib.org/blas/) libraries not found.
  3.     Directories to search for the libraries can be specified in the
  4.     numpy/distutils/site.cfg file (section [blas]) or by setting
  5.     the BLAS environment variable.
复制代码

我需要从这个网站下载哪个tar?
我已经尝试了fortrans,但我一直收到这个错误(在设置环境变量之后)
回复

使用道具 举报

11

主题

80

帖子

199

积分

注册会员

Rank: 2

积分
199
发表于 2018-9-18 18:31:21 | 显示全部楼层
要在没有所需库的预编译包的情况下在操作系统上构建SciPy(和NumPy),您必须构建然后静态链接到Fortran库BLAS和LAPACK:
mkdir -p ~/src/
cd ~/src/
wget http://www.netlib.org/blas/blas.tgz
tar xzf blas.tgz
cd BLAS-*

## NOTE: The selected Fortran compiler must be consistent for BLAS, LAPACK, NumPy, and SciPy.
## For GNU compiler on 32-bit systems:
#g77 -O2 -fno-second-underscore -c *.f                     # with g77
#gfortran -O2 -std=legacy -fno-second-underscore -c *.f    # with gfortran
## OR for GNU compiler on 64-bit systems:
#g77 -O3 -m64 -fno-second-underscore -fPIC -c *.f                     # with g77
gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f    # with gfortran
## OR for Intel compiler:
#ifort -FI -w90 -w95 -cm -O3 -unroll -c *.f

# Continue below irrespective of compiler:
ar r libfblas.a *.o
ranlib libfblas.a
rm -rf *.o
export BLAS=~/src/BLAS-*/libfblas.a
仅执行五个g77 / gfortran / ifort命令中的一个。我使用的是gfortran。随后的LAPACK安装需要Fortran 90编译器,并且由于两个安装都应使用相同的Fortran编译器,因此g77不应用于BLAS。
接下来,您需要安装LAPACK的东西。SciPy网页的说明也帮助了我,但我必须修改它们以适应我的环境:
mkdir -p ~/src
cd ~/src/
wget http://www.netlib.org/lapack/lapack.tgz
tar xzf lapack.tgz
cd lapack-*/
cp INSTALL/make.inc.gfortran make.inc          # On Linux with lapack-3.2.1 or newer
make lapacklib
make clean
export LAPACK=~/src/lapack-*/liblapack.a
回复

使用道具 举报

10

主题

72

帖子

180

积分

注册会员

Rank: 2

积分
180
发表于 2018-9-18 18:32:23 | 显示全部楼层
如果您需要使用最新版本的SciPy而不是打包版本,而无需经历构建BLAS和LAPACK的麻烦,您可以按照以下步骤操作。
从存储库安装线性代数库(对于Ubuntu),
  1. sudo apt-get install gfortran libopenblas-dev liblapack-dev
复制代码
然后安装SciPy,(在下载SciPy源之后):
  1. python setup.py install
复制代码


  1. pip install scipy
复制代码

回复

使用道具 举报

9

主题

74

帖子

185

积分

注册会员

Rank: 2

积分
185
发表于 2018-9-18 18:32:51 | 显示全部楼层
在Fedora上,这有效:
yum install lapack lapack-devel blas blas-devel
pip install numpy
pip install scipy
除了'blas'和'lapack'之外,请记得安装' lapack-devel '和' blas-devel ',否则你会得到你提到的错误或“ numpy.distutils.system_info.LapackNotFoundError ”错误。
回复

使用道具 举报

11

主题

63

帖子

159

积分

注册会员

Rank: 2

积分
159
发表于 2018-9-18 18:33:19 | 显示全部楼层
我猜你在谈论Ubuntu中的安装。只需使用:
apt-get install python-numpy python-scipy
这应该照顾BLAS库编译。另外,编译BLAS库非常困难。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表