liunx 環境下 python模塊numpy,scipy,matplotlib 安裝

NumPy是一個定義了數值數組和矩陣類型和它們的基本運算的語言擴展。

SciPy是另一種使用NumPy來做高等數學、信號處理、優化、統計和許多其它科學任務的語言擴展。

Matplotlib是一個幫助繪圖的語言擴展。


1.首先安裝Numpy,它是matplotlib的先行包,裏面的很多圖形處理函數都要依賴numpy裏的數學計算。

  1)在Debian或Ubuntu中安裝Matplotlib:

       $sudo apt-get install Python-numpy 

  或者:

       $sudo pip install numpy 

  2)在Fedora或CentOS/RHEL環境則可用如下命令:

       $sudo yum install numpy

2.安裝scipy 

       $sudo apt-get install libatlas-base-dev gfortran //這一步是後面安裝scipy所必需的 ,避免scipy安裝失敗,確保所需庫文 件

或者

       $sudo apt-get install python-scipy

       $sudo pip install scipy 

3.安裝matplotlib


  1)可以通過如下命令在Debian或Ubuntu中安裝Matplotlib:

       $ sudo apt-get install python-matplotlib

   或者

       $sudo pip install matplotlib 

  2)在Fedora或CentOS/RHEL環境則可用如下命令:

       $ sudo yum install python-matplotlib


注意:
使用pip會裝到比較新的版本,而apt-get會比較舊。 

如果提示你沒有安裝pip,可執行 sudo apt-get install python-pip進行安裝 

如果出錯,可以試着執行sudo apt-get install build-essential python-dev

安裝時需要用最新版的pip,更新pip:

$sudo pip install --upgrade pip

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章