使用pip安装SciPy和NumPy

2024-04-23 12:27:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在我正在分发的包中创建所需的库。它需要SciPyNumPy库。 在开发时,我使用

apt-get install scipy

它安装了SciPy 0.9.0和NumPy 1.5.1,运行良好。

我想使用pip install执行同样的操作,以便能够在自己包的setup.py中指定依赖项。

问题是,当我尝试:

pip install 'numpy==1.5.1'

它工作得很好。

但后来

pip install 'scipy==0.9.0'

惨败

raise self.notfounderror(self.notfounderror.__doc__)

numpy.distutils.system_info.BlasNotFoundError:

Blas (http://www.netlib.org/blas/) libraries not found.

Directories to search for the libraries can be specified in the

numpy/distutils/site.cfg file (section [blas]) or by setting

the BLAS environment variable.

我怎样才能让它工作?


Tags: installpiptheselfnumpylibrariesgetapt
3条回答

如果您使用的是Ubuntu,那么需要libblas和liblapack dev包。

aptitude install libblas-dev liblapack-dev
pip install scipy

这在Ubuntu 14.04上对我有效:

sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran
pip install scipy

在我的回答中,我假设有Linux的经验;我发现要让pip install scipy顺利进行有三个先决条件。

到这里来:Installing SciPY

按照说明下载、生成并导出BLAS的env变量,然后LAPACK。注意不要盲目地剪切和粘贴shell命令-根据您的体系结构等,您需要选择几行代码,还需要修复/添加它错误地假定的正确目录。

您可能需要的第三件事是yum安装numpy-f2py或等效程序。

哦,是的,最后,您可能需要yum安装gcc gfortran,因为上面的库是Fortran源代码。

相关问题 更多 >