python安裝numpy和pandas

來源:互聯網
上載者:User

標籤:.com   問題   round   x86   pypi   sea   freetype   atp   dateutil   

  最近要對一系列資料做同比比較,需要用到numpy和pandas來計算,不過使用python安裝numpy和pandas因為linux環境沒有外網遇到了很多問題就記下來了。首要條件,python版本必須是2.7以上。

linux首先安裝依賴包

yum -y install blas blas-devel lapack-devel lapackyum -y install seaborn scipyyum -y install freetype freetype-devel libpng libpng-develyum -y install python-pipyum -y install pytz
yum -y install python-dateutil

 

windows安裝pip即可,具體方法參考pip官網 http://pip-cn.readthedocs.io/en/latest/installing.html

  1、 pip方式安裝

如果有外網一般推薦使用pip安裝,linux下和windows下均可使用pip安裝

python -m pip install --upgrade pippip install --user numpy scipy matplotlib jupyter pandas sympy nose

但很快就會發現這些源安裝超級慢,所以我推薦大家使用豆瓣的源

pip install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.compip install numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.compip install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.compip install seaborn scipy  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

  2、如果伺服器上沒有外網使用不了pip,則需要使用源碼安裝。推薦大家在豆瓣pypi下載,速度更快  https://pypi.doubanio.com/simple/?allow_list_dir=1

python numpy安裝包是 https://pypi.python.org/pypi/numpy/,pandas的安裝包是 https://pypi.python.org/pypi/pandas,github地址是 https://github.com/pandas-dev

 

tar -xzf numpy-1.11.2.tar.gzcd numpy-1.11.2python setup.py build  # 編譯幾分鐘python setup.py install  

安裝pandas會提示 ImportError: Building pandas requires cython則需要安裝Cython或者升級Cython先,下載連結 https://pypi.python.org/pypi/Cython/ 。windows下pip安裝如下

pip install Cython

linux下可使用yum安裝或者pip安裝

yum install -y Cython.x86_64

如果需要更新到最新版本的Cython則下載源碼後安裝

cd Cython-0.25.1python setup.py buildpython setup.py install

然後是按照pandas

cd pandas-0.19.0python setup.py build   # 比較久python setup.py install

至此就安裝成功了。

總結,花了一上午安裝這個主要是因為下載源慢,依賴包多。所以建議大家都是用pypi豆瓣源,直接在simple下面搜你需要的安裝包。

原創文章,轉載請備忘原文地址 http://www.cnblogs.com/lxmhhy/p/6029465.html

知識交流討論請加qq:1130010617。謝謝合作。

python安裝numpy和pandas

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.