centos 配置python2.7下的sklearn机器学习组件
#备份源repo
43 mkdir /etc/yum.repos.d/repobak
#
44 cd /etc/yum.repos.d/
46 mv *.repo repobak/
#编辑repo
54 vim base.repo
#
60 yum clean all
#测试
61 yum install vim
72 yum install -y gcc gcc-c++ readline readline-devel zlib zlib-devel bzip2 bzip2-devel sqlite-devel openssl-devel
#建一个放安装包的文件夹
78 mkdir /Packages
79 mv *.tar.gz /Packages/
82 cd /Packages/
84 tar xzvf mpmath-0.19.tar.gz
86 cd mpmath-0.19
- 93 tar zxf Python-2.7.12.tgz
95 cd Python-2.7.12
97 ./configure --prefix=/usr/local/python2.7/
98 make
99 make install
#编辑alias python2.7 ipython
104 vim /etc/bashrc
105 . /etc/bashrc
###添加外部源
122 vim /etc/yum.repos.d/
123 vim /etc/yum.repos.d/base.repo
131 tar zxf setuptools-25.1.6.tar.gz
133 cd setuptools-25.1.6
135 python2.7 setup.py install
164 tar zxf sympy-1.0.tar.gz
166 cd sympy-1.0
168 python2.7 setup.py install
170 cd ..
173 tar zxf numpy-1.11.1.tar.gz
175 cd numpy-1.11.1
177 python2.7 setup.py install
#缺依赖,then:
#
192 tar zxf Cython-0.24.1.tar.gz
194 cd Cython-0.24.1
197 python2.7 setup.py install
198 cd ..
----------------------------------------numpy ↑
200 cd numpy-1.11.1
201 ls
202 python2.7 setup.py install
203 cd ..
209 tar zxf scipy-0.18.0.tar.gz
210 cd scipy-0.18.0
212 python2.7 setup.py install
213 yum search blas
214 yum install blas
215 yum install blas-devel
216 yum search lapack
217 yum install lapack
218 python2.7 setup.py install
219 yum search blas
220 yum install blas-devel
#自带blas源有问题,下载外部rpm,包括lapack-devel,blas-devel
222 mv /home/yuan/*.rpm /Packages/
226 rpm -ivh /Packages/*.rpm
#提示安装依赖
227 yum install gcc-gfortran
#再安装
228 rpm -ivh /Packages/*.rpm
#安scipy
229 python2.7 setup.py install
#安装matplotlib的依赖
241 yum install libpng-devel freetype
242 python2.7 setup.py install
#yum没有Python内部的包pyparsing,下载安装
252 unzip pyparsing-2.1.8.zip
254 cd pyparsing-2.1.8
256 python2.7 setup.py install
#依赖
266 tar zxf cycler-0.10.0.tar.gz
268 cd cycler-0.10.0
270 python2.7 setup.py install
#依赖six
273 tar zxf six-1.10.0.tar.gz
274 cd six-1.10.0
276 python2.7 setup.py install
#再安装
279 cd cycler-0.10.0
280 python2.7 setup.py install
#ok
#继续matplotlib,还提示
#安装依赖
287 tar zxf pytz-2016.6.1.tar.gz
289 cd pytz-2016.6.1
291 python2.7 setup.py install
298 tar zxf subprocess32-3.2.7.tar.gz
299 cd subprocess32-3.2.7
301 python2.7 setup.py install
308 tar zxf functools32-3.2.3-2.tar.gz
309 cd functools32-3.2.3-2
310 ls
311 python2.7 setup.py install
321 tar zxf python-dateutil-2.5.3.tar.gz
322 cd python-dateutil-2.5.3
324 python2.7 setup.py install
372 yum install -y tkinter tk-devel
#看版本
373 rpm -qa | grep ^tk
374 rpm -qa | grep ^tcl
375 yum -y install tcl-devel tk-devel
376 cd /Packages/Python2.7/
377 vim Modules/Setup.dist
#找到下面这几行,把前面的井号去掉打开它
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
-L/usr/local/lib \
-I/usr/local/include \
-ltk8.5 -ltcl8.5 \
-lX11
378 ./configure --prefix=/usr/local/python2.7/
379 make
380 make install
#测试一下
381 ipython
import matplotlib.pyplot
386 tar zxf scikit-learn-0.17.1.tar.gz
387 cd scikit-learn-0.17.1
389 python2.7 setup.py build
#跑实例程序测试
401 python2.7 101_example.py
#OK 搞定