Python 心得
Posted on Wed 04 July 2018 in Python
Python
Python是一種直譯式高階程式語言,由 Guido van Rossum 發明,其哲學是強調 code 的可讀性和簡潔的語法,而且具有動態型別與自動記憶體管理功能。Python 常被用於 Web 開發與科學計算,特別是最近機器學習函式庫幾乎都有提供 Python API。
為什麼我要選擇 Python?
我在大學時期比較常用的是 MATLAB 來做科學計算,MATLAB 確實方便好用,但畢竟是付費軟體,通常個人也買不起,出了校門可能就沒辦法用,因此嘗試轉用 Python。因為 Python 是開源的高階語言,藉由開源社群的力量,有著大量的函式庫,能做的事其實比 MATLAB 還多,而且用起來更自由,不用像 MATLAB 綁定傻大粗又不穩的開發環境。個人覺得以科學計算而言,Python 的上手難度沒有比 MATLAB 難上多少,但是可以獲得自由,所以入坑 Python。
Anaconda Distribution
簡介
Anaconda Distribution是一個面相資料科學的免費 Python 發行版,收集了超過 1000 種的開源套件,並有自己的套件與環境管理工具,適合 Python 的新手使用,安裝方式很像 MATLAB,主程式 +Toolbox。
Anaconda 對 Windows、macOS 與 Linux 都有提供支援,同時支援 Python 2 和 Python 3,安裝包預裝超過 150 個套件,並可以選擇性安裝開源的 IDE Spyder或是Visual Studio Code,但是也可以搭配任何支援 Python 的開發環境或是編輯器使用,可以選自己喜歡的用法,像我目前偏好搭配 Visual Studio Code 使用,因為它輕量且與Git整合度高。
Conda
conda是 Anaconda 自帶的套件管理工具,conda 的用法,官方有提供簡單上手的表格如下
常用套件
Package | Summary |
---|---|
imageio | A library for reading and writing image |
IPython | Productive Interactive Computing |
Jupyter | Jupyter Notebook |
Matplotlib | A rich architecture for interactive computing |
NumPy | Array processing for numbers, strings, records, and objects |
OpenCV | Computer vision and machine learning library |
scikit-image | A collection of algorithms for image processing |
scikit-learn | A set of python modules for machine learning and data mining |
SciPy | Scientific library for mathematics, science, and engineering |
PyTorch | An open source machine learning framework that accelerates the path from research prototyping to production deployment. |
TensorFlow | An end-to-end open source machine learning platform |