问题:使用pip安装SciPy和NumPy

我正在尝试在要分发的程序包中创建所需的库。它需要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.

我该如何工作?

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

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

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.

The problem is, when I try:

pip install 'numpy==1.5.1'

it works fine.

But then

pip install 'scipy==0.9.0'

fails miserably, with

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.

How do I get it to work?


回答 0

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

转到此处:安装SciPY

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

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

哦,是的,最后,您可能需要安装gcc-gfortran,因为上述库都是Fortran源码。

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

Go here: Installing SciPY

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.

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

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


回答 1

这在Ubuntu 14.04上对我有用:

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

This worked for me on Ubuntu 14.04:

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

回答 2

如果使用的是Ubuntu,则需要libblas和liblapack开发软件包。

aptitude install libblas-dev liblapack-dev
pip install scipy

you need the libblas and liblapack dev packages if you are using Ubuntu.

aptitude install libblas-dev liblapack-dev
pip install scipy

回答 3

由于先前使用yum进行安装的说明已被破坏,因此这里提供了在诸如fedora之类的设备上进行安装的更新说明。我已经在“ Amazon Linux AMI 2016.03”上对此进行了测试

sudo yum install atlas-devel lapack-devel blas-devel libgfortran
pip install scipy

Since the previous instructions for installing with yum are broken here are the updated instructions for installing on something like fedora. I’ve tested this on “Amazon Linux AMI 2016.03”

sudo yum install atlas-devel lapack-devel blas-devel libgfortran
pip install scipy

回答 4

我当时正在从事一个依赖于numpy和scipy的项目。在Fedora 23的全新安装中,使用适用于Python 3.4的python虚拟环境(也适用于Python 2.7),并在setup.py中使用以下内容(在setup()方法中)

setup_requires=[
    'numpy',
],
install_requires=[
    'numpy',
    'scipy',
],

我发现必须运行以下命令才能pip install -e .开始工作:

pip install --upgrade pip

sudo dnf install atlas-devel gcc-{c++,gfortran} subversion redhat-rpm-config

redhat-rpm-config是SciPy的的使用redhat-hardened-cc1,而不是常规cc1

I was working on a project that depended on numpy and scipy. In a clean installation of Fedora 23, using a python virtual environment for Python 3.4 (also worked for Python 2.7), and with the following in my setup.py (in the setup() method)

setup_requires=[
    'numpy',
],
install_requires=[
    'numpy',
    'scipy',
],

I found I had to run the following to get pip install -e . to work:

pip install --upgrade pip

and

sudo dnf install atlas-devel gcc-{c++,gfortran} subversion redhat-rpm-config

The redhat-rpm-config is for scipy’s use of redhat-hardened-cc1 as opposed to the regular cc1


回答 5

Windows python 3.5上,我设法scipy使用conda not 进行安装pip

conda install scipy

On windows python 3.5, I managed to install scipy by using conda not pip:

conda install scipy

回答 6

这是什么操作系统?答案可能取决于所涉及的操作系统。但是,您似乎需要找到此BLAS库并进行安装。它似乎不在PIP中(因此您必须手工完成),但是如果您安装它,则应该让您进行SciPy安装。

What operating system is this? The answer might depend on the OS involved. However, it looks like you need to find this BLAS library and install it. It doesn’t seem to be in PIP (you’ll have to do it by hand thus), but if you install it, it ought let you progress your SciPy install.


回答 7

就我而言,升级点可以解决问题。另外,我已经用-U参数安装了scipy(将所有软件包升级到最新的可用版本)

in my case, upgrading pip did the trick. Also, I’ve installed scipy with -U parameter (upgrade all packages to the last available version)


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。