安装基于Python3 的NumPy, SciPy, matplotlib和Scikit-Learn
2014-12-28 00:02
1116 查看
from http://www.th7.cn/Program/Python/201408/263786.shtml
软件版本:Ubuntun 14.04, Python 3.4, NumPy 1.8.1, SciPy 0.14.0, Scikit-Learn 0.16
Numpy, SciPy 的官网安装文档,安装的是基于Python 2.7的,SciPy-Learn 官网的安装文档,也是Python 2.7的,如果想基于高大上的Python 3,该怎么安装呢?经过一堆的坑之后,我摸索出了方法。
设置Python3为默认Python
关闭当前Shell,重新开一个新Shell,输入python就发现进入Python 3.4 的交互环境了。
这里主要的坑是make, 刚开始我直接用
我给 Scikit-Learn 的邮件组发了封邮件,不久得到了回复,要在make 后面加上
软件版本:Ubuntun 14.04, Python 3.4, NumPy 1.8.1, SciPy 0.14.0, Scikit-Learn 0.16
Numpy, SciPy 的官网安装文档,安装的是基于Python 2.7的,SciPy-Learn 官网的安装文档,也是Python 2.7的,如果想基于高大上的Python 3,该怎么安装呢?经过一堆的坑之后,我摸索出了方法。
1. 安装Python 3
首先我们要安装Python 3, 不过,千万别因为有了Python 3, 就卸载系统自带的Python 2.7,很多软件依赖它,所以不能卸载[code]$ sudo apt-get install python3 |
[code]$ vi ~/.bash_aliases$ alias python=python3wq |
2. 安装 NumPy SciPy SymPy 等软件
参考http://www.scipy.org/install.html, 只不过改成了 python3[code]sudo apt-get install python3-numpy python3-scipy python3-matplotlib ipython3 ipython3-notebook python3-pandas python-sympy python3-nose |
3. 安装 Scikit-Learn
参考http://scikit-learn.org/stable/install.html, 不过要修改成python3[code]sudo apt-get install build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-basesudo update-alternatives --set libblas.so.3 /usr/lib/atlas-base/atlas/libblas.so.3sudo update-alternatives --set liblapack.so.3 /usr/lib/atlas-base/atlas/liblapack.so.3sudo apt-get install gfortransudo apt-get install git, 并配置好gitmkdir -p ~/local/srccd ~/local/srcgit clone git@github.com:scikit-learn/scikit-learn.gitcd scikit-learnpython setup.py install --user #开始编译make PYTHON=python3 NOSETESTS=nosetests3 #或者使用make编译nosetests3 -v sklearn #单元测试,可以在任何位置运行,不一定要在源码目录里 |
make, 失败,因为它默认是去找Python 2.7的 python.h 来编译,而我没有安装 python-dev, 只是安装了python3-dev,所以会编译失败。
我给 Scikit-Learn 的邮件组发了封邮件,不久得到了回复,要在make 后面加上
PYTHON=python3,这次编译成功了,不过到单元测试时说找不到
nosetests命令,当然找不到了,因为前面安装的是python3-nose而不是python-nose,于是我猜测了一把,用
make PYTHON=python3 NOSETESTS=nosetests3试试, 果然可以!
相关文章推荐
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- window下安装Python的机器学习包numpy+scipy+matplotlib+scikit-learn
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- 在windows上安装python的机器学习包numpy scipy scikit_learn matplotlib
- python3.6下安装(numpy,scipy,pandas,matplotlib,scikit-learn)
- win7 64+python2.7.12安装numpy+scipy+matplotlib+scikit-learn
- win10+python3.6安装numpy,scipy,scikit-learn,matplotlib
- win7系统下python安装numpy,matplotlib,scipy和scikit-learn
- Python2.7安装Numpy+Scipy+Matplotlib+Scikit-Learn
- 64位32位windows7安装python34和python27,numpy,scipy,matplotlib,scikit-learn等第三方模块
- python及相关模块库的安装教程,例如pygame,Numpy, Scipy, matplotlib和scikit-learn等模块sklearn库
- 在Ubuntu Linux 安装Python第三方库:NumPy,SciPy,Matplotlib, Scikit-Learn,Theao等
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- python3.6中安装numpy,pandas,scipy,scikit_learn,matplotlib等数据分析工具
- win7 安装openCV Python 与 Numpy,Scipy,Matplotlib,Scikit-Learn包
- 机器学习-Python scikit-learn 安装numpy,SciPy,matplotlib
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- win7下安装Python,numpy,matplotlib,scipy,scikit-learn等机器视觉工具包
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- window下安装Python的机器学习包numpy+scipy+matplotlib+scikit-learn