Python 在 Ubuntu 上安装 SciPy
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14408123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing SciPy on Ubuntu
提问by Hyman Gibson
I have Python 2.7 running and trying to install scipy by using easy_install which returns following errors:
我运行 Python 2.7 并尝试使用返回以下错误的 easy_install 安装 scipy:
Searching for scipy
Reading http://pypi.python.org/simple/scipy/
Reading http://www.scipy.org
Reading http://sourceforge.net/project/showfiles.php?group_id=27747&package_id=19531
Reading http://new.scipy.org/Wiki/Download
Best match: scipy 0.11.0
Downloading http://pypi.python.org/packages/source/s/scipy/scipy-0.11.0.zip#md5=40b700ddde9ddab643b640fff7a9d753
Processing scipy-0.11.0.zip
Running scipy-0.11.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-49BQSz/scipy-0.11.0/egg-dist-tmp-KMjwKy
Running from scipy source directory.
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1425: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1434: UserWarning:
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.
warnings.warn(BlasNotFoundError.__doc__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1437: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
warnings.warn(BlasSrcNotFoundError.__doc__)
error:
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.
So I installed Blas and Atalas by executing
所以我通过执行安装了 Blas 和 Atalas
apt-get install blas
apt-get install atlas
However, the easy_install errors don't disappear.
但是,easy_install 错误不会消失。
Thanks!
谢谢!
采纳答案by flup
Ubuntu puts library files in a rather exotic directory.
/usr/lib/x86_64-linux-gnu/or something, depending on your architecture.
You need to add this directory to the site.cfg file or the BLAS environment variable.
Ubuntu 将库文件放在一个相当奇特的目录中。
/usr/lib/x86_64-linux-gnu/或其他什么,取决于您的架构。您需要将此目录添加到 site.cfg 文件或 BLAS 环境变量中。
If easy install also needs the header files, you need to install the respective -dev packages.
如果easy install 还需要头文件,则需要安装相应的-dev 包。
But, like @pitsanu-swangpheaw suggests, you can also install to the site packages directory using the ubuntu package manager.
但是,就像@pitsanu-swangpheaw 建议的那样,您也可以使用 ubuntu 包管理器安装到站点包目录。
sudo apt-get install python-numpy python-scipy
回答by Hyman Gibson
I solved the issue by running (similar to previous suggestions)
我通过运行解决了这个问题(类似于以前的建议)
apt-get install scipy
回答by AMIT SINGH
sudo apt-get install python-scipyworked in my case.
sudo apt-get install python-scipy在我的情况下工作。
回答by Carl Ekerot
What worked for me:
什么对我有用:
To actually install scipy from PIP, you need packages libatlas-base-dev(libraries etc. for ATLAS/BLAS) and gfortran(GNU Fortran compiler).
要从 PIP 实际安装 scipy,您需要软件包libatlas-base-dev(ATLAS/BLAS 的库等)和gfortran(GNU Fortran 编译器)。
Once these packages are installed, the scipy installer should finish as expected.
安装这些软件包后,scipy 安装程序应该会按预期完成。
回答by ChillarAnand
If you are using Python3, You can install packages using apt-get
如果您使用的是 Python3,您可以使用安装包 apt-get
sudo apt-get install python3-numpy python3-scipy
回答by Sam Whitlock
If you want to still install using pip, you can use build-dep to get the dependencies of python-numpy and python-scipy, and then install using pip
如果还想安装 using pip,可以使用 build-dep 获取 python-numpy 和 python-scipy 的依赖,然后安装 usingpip
sudo apt-get build-dep python-numpy python-scipy
Substitute for python3 as the other answers state of that's what you're looking for.
替代 python3 作为其他答案状态,这就是您正在寻找的内容。
回答by zed khaleghi
I solve this problem with running:
我通过运行解决了这个问题:
sudo pip install scipy

