本文整理了Pyhton中與機器學習相關的一些庫的安裝過程,包括:sklearn,matplotlib,LibSVM,TensorFlow。
一、sklearn(即scikit-learn)
1.安裝numpy:
# [sudo] pip install numpy
2.安裝scipy:
(1)$ sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran
(2)$ sudo pip install scipy
3.安裝scikit-learn:
$ sudo pip install sklearn
4.測試:
打開終端輸入pip list,如果此時出現了sklearn這一項,就是大功告成了。
二、matplotlib
# sudo apt-get install python-matplotlib
三、LibSVM
詳見我的另一篇博客,鏈接:Ubuntu下安裝和使用LibSVM
四、TensorFlow
1.安裝:
(1)# sudo pip install tensorflow
(2)# sudo pip install tensorflow-gpu
2.測試-Python環境:
import tensorflow as tf
hello=tf.constant('Hello, TensorFlow!')
sess=tf.Session()
print(sess.run(hello))