歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> Ubuntu下安裝numpy and matplotlib

Ubuntu下安裝numpy and matplotlib

日期:2017/3/3 11:29:37   编辑:Linux技術

Ubuntu-Python2.7安裝 scipy,numpy,matplotlib

可以先直接執行安裝命令:
sudo apt-get install python-scipy
sudo apt-get install python-numpy
sudo apt-get install python-matplotlib
如果你不知道自己安裝成功了沒有,可以再執行一遍代碼,若出現“安裝版本已是最新版本”,則表示安裝成功。
若命令安裝不成功,可以嘗試下面方法。
下面內容是在該博文(http://my.oschina.net/u/939893/blog/163921)的基礎上進行安裝的,部分地方做了解釋與說明。
安裝numpy相對簡單,以下命令可以完成
[code]apt-get install python-numpy apt-get install python-scipy

安裝matplotlib相對復雜一些
需要先安裝其依賴的包libpng和freetype
安裝libpng:
[code]sudo apt-get install libpng-dev

安裝freetype: (安裝命令如下)
cd ~/Downloads
wgethttp://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz tar zxvf freetype-2.4.10.tar.gz (我是將2、3步合在一起,我是自己下載的壓縮包,因為執行第2步時出現錯誤,第2步裡的網址是迅雷下載地址)
cd freetype-2.4.10/
./configure (這一個看自己的文件夾裡,原來這裡是 ./congfigure 可是我freetype-2.4.10文件夾下沒有這個文件,只有 configure,所以我改成了configure,這個地方大家看著自己那裡的改改吧,我感覺是原來那位大牛筆誤了)
make
sudo make install
安裝pip,然後通過pip來安裝matplotlib:
sudo apt-get install python-pip

安裝好pip後就可以用下面的命令來查找matplotlib和查看其安裝狀態
sudo pip search matplotlib

安裝matplotlib
sudo pip install matplotlib
Copyright © Linux教程網 All Rights Reserved