使用 pip 安装 SciPy 和 NumPy [英] Installing SciPy and NumPy using pip

查看:35
本文介绍了使用 pip 安装 SciPy 和 NumPy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to create required libraries in a package I'm distributing. It requires both the SciPy and NumPy libraries. While developing, I installed both using

apt-get install scipy

安装了 SciPy 0.9.0 和 NumPy 1.5.1,并且运行良好.

which installed SciPy 0.9.0 and NumPy 1.5.1, and it worked fine.

我想使用 pip install 做同样的事情 - 为了能够在我自己的包的 setup.py 中指定依赖项.

I would like to do the same using pip install - in order to be able to specify dependencies in a setup.py of my own package.

问题是,当我尝试时:

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.

我如何让它工作?

推荐答案

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

I am assuming Linux experience in my answer; I found that there are three prerequisites to getting pip install scipy to proceed nicely.

转到此处:安装 SciPY

按照说明下载、构建和导出 BLAS 的 env 变量,然后是 LAPACK.注意不要盲目地剪切和粘贴 shell 命令 - 根据您的架构等,您需要选择几行,并且您需要修复/添加它错误地假定为的正确目录嗯.

Follow the instructions to download, build and export the env variable for BLAS and then LAPACK. Be careful to not just blindly cut'n'paste the shell commands - there will be a few lines you need to select depending on your architecture, etc., and you'll need to fix/add the correct directories that it incorrectly assumes as well.

您可能需要的第三件事是yum install numpy-f2py 或类似的东西.

The third thing you may need is to yum install numpy-f2py or the equivalent.

哦,是的,最后,您可能需要yum install gcc-gfortran,因为上面的库是Fortran 源代码.

Oh, yes and lastly, you may need to yum install gcc-gfortran as the libraries above are Fortran source.

这篇关于使用 pip 安装 SciPy 和 NumPy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆