CentOS 6.5下安装NumPy、SciPy、Scikit-Learn

一、更新python版本

   1. 查看python版本

    [root@localhost ipython-5.1.0]# python -V

    Python 2.6.6

  2. 下载python-2.7.3

    https://www.python.org/download/releases/2.7.3/

    Python-2.7.3.tar.bz2

  3. 解压缩并更改工作目录

    tar -jxvf Python-2.7.3.tar.bz2

    cd Python-2.7.3

  4. 安装

    ./configure

    make all

    make install

    make clean

    make distclean

    /usr/local/bin/python2.7 -V

  5. 建立软链接,使系统默认的python指向python2.7

    [root@localhost Python-2.7.3]# mv /usr/bin/python /usr/bin/python2.6.6

    [root@localhost Python-2.7.3]# ln -s /usr/local/bin/python2.7 /usr/bin/python

    [root@localhost Python-2.7.3]# python -V

    Python 2.7.3

  6. 指定 yum 的Python版本

    解决系统 Python 软链接指向 Python2.7 版本后,因为yum是不兼容 Python 2.7的,所以yum不能正常工作,我们需要

    vi /usr/bin/yum将文件头部的#!/usr/bin/python改成#!/usr/bin/python2.6.6


二、安装pip

  1. 下载安装setuptools

  2. 下载安装pip

三、安装NumPy、Pandas、SciPy、matplotlib

  1. 安装依赖包

    scipy需要依赖于第三方软件包,例如atlas、blas等

    yum install blas-devel lapack-devel

  2. 使用pip安装

    pip install numpy

    pip install pandas

    pip install scipy

    pip install scikit-learn

    pip install matplotlib

    pip install ipython

四、运行ipython后显示WARNING: IPython History requires SQLite, your history will not be saved

  下载并解压sqlite包,输入命令:

    #wget http://www.sqlite.org/sqlite-autoconf-3071401.tar.gz

    #tar zxvf sqlite-autoconf-3071401.tar.gz

  在sqlite-autoconf-3071401目录下配置、编译、安装,输入命令:

    #./configure --prefix=/usr/local/

    #make

    #make install

  重新编译安装python2.7,输入命令:

    #cd Python-2.7.3 

    #./configure 

    #make all

    #make install

    #make clean

    #make distclean

  重新启动ipython查看信息

    #ipython

参考:http://blog.csdn.net/u013107656/article/details/51660193

   http://www.cnblogs.com/mologa-jie/p/6064779.html

原文地址:https://www.cnblogs.com/wnzhong/p/6308669.html