centos 配置python2.7下的sklearn机器学习组件

  1. #备份源repo
  2. 43 mkdir /etc/yum.repos.d/repobak
  3. #
  4. 44 cd /etc/yum.repos.d/
  5. 46 mv *.repo repobak/
  6. #编辑repo
  7. 54 vim base.repo
  8. #
  9. 60 yum clean all
  10. #测试
  11. 61 yum install vim
  12. 72 yum install -y gcc gcc-c++ readline readline-devel zlib zlib-devel bzip2 bzip2-devel sqlite-devel openssl-devel
  13. #建一个放安装包的文件夹
  14. 78 mkdir /Packages
  15. 79 mv *.tar.gz /Packages/
  16. 82 cd /Packages/
  17. 84 tar xzvf mpmath-0.19.tar.gz
  18. 86 cd mpmath-0.19
  19. 93 tar zxf Python-2.7.12.tgz
  20. 95 cd Python-2.7.12
  21. 97 ./configure --prefix=/usr/local/python2.7/
  22. 98 make
  23. 99 make install
  24. #编辑alias python2.7 ipython
  25. 104 vim /etc/bashrc
  26. 105 . /etc/bashrc
  27. ###添加外部源
  28. 122 vim /etc/yum.repos.d/
  29. 123 vim /etc/yum.repos.d/base.repo
  30. 131 tar zxf setuptools-25.1.6.tar.gz
  31. 133 cd setuptools-25.1.6
  32. 135 python2.7 setup.py install
  33. 164 tar zxf sympy-1.0.tar.gz
  34. 166 cd sympy-1.0
  35. 168 python2.7 setup.py install
  36. 170 cd ..
  37. 173 tar zxf numpy-1.11.1.tar.gz
  38. 175 cd numpy-1.11.1
  39. 177 python2.7 setup.py install
  40. #缺依赖,then:
  41. #
  42. 192 tar zxf Cython-0.24.1.tar.gz
  43. 194 cd Cython-0.24.1
  44. 197 python2.7 setup.py install
  45. 198 cd ..
  46. ----------------------------------------numpy ↑
  47. 200 cd numpy-1.11.1
  48. 201 ls
  49. 202 python2.7 setup.py install
  50. 203 cd ..
  51. 209 tar zxf scipy-0.18.0.tar.gz
  52. 210 cd scipy-0.18.0
  53. 212 python2.7 setup.py install
  54. 213 yum search blas
  55. 214 yum install blas
  56. 215 yum install blas-devel
  57. 216 yum search lapack
  58. 217 yum install lapack
  59. 218 python2.7 setup.py install
  60. 219 yum search blas
  61. 220 yum install blas-devel
  62. #自带blas源有问题,下载外部rpm,包括lapack-devel,blas-devel
  63. 222 mv /home/yuan/*.rpm /Packages/
  64. 226 rpm -ivh /Packages/*.rpm
  65. #提示安装依赖
  66. 227 yum install gcc-gfortran
  67. #再安装
  68. 228 rpm -ivh /Packages/*.rpm
  69. #安scipy
  70. 229 python2.7 setup.py install
  71. #安装matplotlib的依赖
  72. 241 yum install libpng-devel freetype
  73. 242 python2.7 setup.py install
  74. #yum没有Python内部的包pyparsing,下载安装
  75. 252 unzip pyparsing-2.1.8.zip
  76. 254 cd pyparsing-2.1.8
  77. 256 python2.7 setup.py install
  78. #依赖
  79. 266 tar zxf cycler-0.10.0.tar.gz
  80. 268 cd cycler-0.10.0
  81. 270 python2.7 setup.py install
  82. #依赖six
  83. 273 tar zxf six-1.10.0.tar.gz
  84. 274 cd six-1.10.0
  85. 276 python2.7 setup.py install
  86. #再安装
  87. 279 cd cycler-0.10.0
  88. 280 python2.7 setup.py install
  89. #ok
  90. #继续matplotlib,还提示
  91. #安装依赖
  92. 287 tar zxf pytz-2016.6.1.tar.gz
  93. 289 cd pytz-2016.6.1
  94. 291 python2.7 setup.py install
  95. 298 tar zxf subprocess32-3.2.7.tar.gz
  96. 299 cd subprocess32-3.2.7
  97. 301 python2.7 setup.py install
  98. 308 tar zxf functools32-3.2.3-2.tar.gz
  99. 309 cd functools32-3.2.3-2
  100. 310 ls
  101. 311 python2.7 setup.py install
  102. 321 tar zxf python-dateutil-2.5.3.tar.gz
  103. 322 cd python-dateutil-2.5.3
  104. 324 python2.7 setup.py install
  105. 372 yum install -y tkinter tk-devel
  106. #看版本
  107. 373 rpm -qa | grep ^tk
  108. 374 rpm -qa | grep ^tcl
  109. 375 yum -y install tcl-devel tk-devel
  110. 376 cd /Packages/Python2.7/
  111. 377 vim Modules/Setup.dist
  112. #找到下面这几行,把前面的井号去掉打开它
  113. _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
  114. -L/usr/local/lib \
  115. -I/usr/local/include \
  116. -ltk8.5 -ltcl8.5 \
  117. -lX11
  118. 378 ./configure --prefix=/usr/local/python2.7/
  119. 379 make
  120. 380 make install
  121. #测试一下
  122. 381 ipython
  123. import matplotlib.pyplot
  124. 386 tar zxf scikit-learn-0.17.1.tar.gz
  125. 387 cd scikit-learn-0.17.1
  126. 389 python2.7 setup.py build
  127. #跑实例程序测试
  128. 401 python2.7 101_example.py
  129. #OK 搞定





posted @ 2016-08-24 15:46  iAthena  阅读(1045)  评论(0编辑  收藏  举报