2015年8月4日 星期二

在mac下安裝函式庫numpy和matplotlib於python3.4.3

更新:http://ntudavid.blogspot.com/2015/10/python35-numpy-matplotlib-scipy.html

numpy和matplotlib大概是python最essential的第三方套件吧。
至少我覺得如果要python跟matlab相提並論的話,沒安裝這兩個函式庫就像斷了左右手一樣。
python是以資料分析著名的,也是靠很多開源的第三方套件來支援的。

在mac下於python3.4.3安裝numpy和matplotlib兩個套件其實不算太難。
首先先google或到官方網站下載各別的.whl 文件。(假設下載到預設的Downloads資料夾)
可能要注意選擇符合python3.4的版本來下載。
然後開啟Terminal,首先先安裝開啟.whl文件的工具:

sudo pip3 install wheel

因為是安裝,所以會要輸入密碼,通過後才能完成安裝。

然後更改路徑到存放.whl文件的路徑下:

cd /Users/david/Downloads

最後是安裝numpy 和 matplotlib 的指令:

sudo pip3 install numpy_1.9.2-cp34.........whl

sudo pip3 install matplotlib-1.4.3-cp34.........whl

最後的最後,要到shell那邊測試一下安裝有沒有成功:
#np.後面是兩個底線

import numpy as np
np.__version__
>>> '1.9.2'

import matplotlib
matplotlib.__version__
>>> '1.4.3'


沒有留言:

張貼留言