Ubuntu系统下为Python安装Scipy模块

来源:互联网 发布:程序员学英语有用吗? 编辑:程序博客网 时间:2024/05/16 10:47

本文摘自Scipy官网:

对于大多数用户,尤其是Window用户而言,最简单的安装Scipy的方式是安装打包装好的Python版本,例如:Anaconda, Enthought Canopy, Python(x, y), WinPython, Pyzo等。这些版本的Python中都已经打包好了常用的科学计算模块。

如果用户使用的是原生的Python,默认并没有包含Scipy模块。另行安装时,推荐用已经编译好的Scipy包。当然如果你特别精通编译源码,可以选择从GitHub上下载源码,自行编译后安装。

通过pip安装Scipy

由于pip对Window支持的不够,所以本方式针对Mac和Linux系统。第一步:升级pip到最新版本:

python -m pip install --upgrade pip

第二步:安装Scipy,建议在命令行上加上 --user 标识,此时安装仅仅针对当前用户,无需往系统目录内添加东西。

pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
第三步:设置环境变量,举例:

# linux# Consider adding this at the end of your ~/.bashrc fileexport PATH="$PATH:/home/your_user/.local/bin"
将your_user替换为你的用户名

通过Linux包管理安装(Ubuntu & Debian)

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

通过Scipy版本和安装路径

# 版本python -c "import scipy; print scipy.version.version"
# 路径python -c "import scipy; print scipy.__file__"








原创粉丝点击