NumPy學習筆記 一
NumPy學習筆記 一
《NumPy學習筆記》系列將記錄學習NumPy過程中的動手筆記,前期的參考書是《Python數據分析基礎教程 NumPy學習指南》第二版、《數學分析》第四版(華東師範大學數學系)、《概率論與數理統計》(陳希孺,中科大出版)、《概率論與數理統計》第二版(茆詩松、程依明等編)、《組合最優化:理論與方法》(現代數學譯叢23)。筆記一主要記錄NumPy&SciPy及相關軟件的環境準備部分。
NumPy的官方網站上(http://www.numpy.org/)詳細介紹了三種安裝NumPy&SciPy的方法(https://www.scipy.org/scipylib/download.html
一. 官方源碼及二進制發布
Project |
Available packages |
Download location |
NumPy |
Official source code (all platforms) and binariesfor Windows, Linux and Mac OS X |
PyPI page for NumPy |
SciPy |
Official source code (all platforms) and binariesfor Windows, Linux and Mac OS X |
SciPy release page (sources) PyPI page for SciPy (all) |
推薦使用Python pip來安裝,簡單,並且獲取的是最新的發布版。
以下命令在ubuntu 17.10上安裝NumPy&SciPy
sudo apt install python3-pip pip3 install numpy pip3 install scipy
二. 訪問源代碼倉庫
NumPy和SciPy的官方倉庫都在Github上。
檢出最新的NumPy源碼:
git clone https://github.com/numpy/numpy.git
檢出最新的SciPy源碼:
git clone https://github.com/scipy/scipy.git
編譯參考:https://docs.scipy.org/doc/scipy-dev/reference/building/index.html
三. 第三方/供應商 包管理器
下面是部分第三方和操作系統供應商包管理器包含的NumPy和SciPy包
Distribution |
NumPy Packages |
SciPy Packages |
Arch Linux |
python-numpy |
python-scipy |
Debian GNU/Linux |
python-numpy |
python-scipy |
Ubuntu Linux |
python-numpy |
python-scipy |
Fedora |
numpy |
scipy |
Fink |
numpy-py27, numpy-py35 |
scipy-py27, scipy-py35 |
FreeBSD (Ports) |
math/py-numpy |
science/py-scipy |
Gentoo Linux |
dev-python/numpy |
sci-libs/scipy |
MacPorts |
py-numpy, |
py-scipy, |
NetBSD (pkgsrc) |
math/py-numpy |
math/py-scipy |
OpenSUSE |
python-numpy, python-numpy-devel |
python-scipy, python-scipy-devel |
Slackware Linux |
numpy (slackbuilds.org) |
scipy (slackbuilds.org) |
在Ubuntu 17.10上安裝通過apt包管理器安裝
sudo apt install num-py sudo apt install python-numpy
不推薦使用該種方式,因為獲取的軟件版本往往較低。
安裝matplotlib和ipython,同樣推薦使用pip安裝:
pip3 install matplotlib pip3 install ipython
NumPy學習筆記 一