Python演算法庫的安裝
Python演算法庫包含以下幾個程式包,官方下載地址:
下載的演算法庫要與安裝的Python版本一致,比如安裝的是Python3.7-64位版本,下載的演算法庫要為cp37...win_amd64,否則安裝時會報錯。Python演算法庫的安裝順序為:NumPy->SciPy->Matplotlib->Scikit-Learn。
NumPy:
array processing for numbers, strings, records, and objects.
NumPy是一個開源的Python科學計算庫。使用NumPy,就可以很自然地使用陣列和矩陣。NumPy包含很多實用的數學函式,涵蓋線性代數運算、傅立葉變換和隨機數生成等功能。NumPy通常與SciPy和Matplotlib一起使用,這種組合廣泛用於替代MatLab(一個流行的技術計算平臺),Python作為MatLab的替代方案,現在被視為一種更加現代和完整的程式語言。
安裝:
C:\Program Files\Python37\Scripts>pip install d:\numpy-1.15.2-cp37-none-win_amd64.whl
Processing d:\numpy-1.15.2-cp37-none-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.15.2
SciPy:
Scientific Library for Python.
SciPy是一個開源的Python科學計算庫,建立在Numpy之上。它增加的功能包括數值積分、最最佳化、統計和一些專用函式。SciPy函式庫在NumPy庫的基礎上增加了眾多的數學、科學以及工程計算中常用的庫函式。例如插值運算、線性代數、常微分方程數值求解、訊號處理、影像處理、稀疏矩陣等等。
安裝:
C:\Program Files\Python37\Scripts>pip install d:\scipy-1.1.0-cp37-none-win_amd64.whl
Processing d:\scipy-1.1.0-cp37-none-win_amd64.whl
Requirement already satisfied: numpy>=1.8.2 in c:\program files\python37\lib\site-packages (from scipy==1.1.0) (1.15.2)
Installing collected packages: scipy
Successfully installed scipy-1.1.0
Matplotlib:
Python plotting package.
Matplotlib是一個Python 2D繪相簿,它可以在各種平臺上以各種硬複製格式和互動式環境生成具有出版品質的圖形。Matplotlib只需幾行程式碼即可生成曲線圖、直方圖、曲餅圖、散點圖等。
安裝:
C:\Program Files\Python37\Scripts>pip install d:\matplotlib-3.0.0-cp37-cp37m-win_amd64.whl
Processing d:\matplotlib-3.0.0-cp37-cp37m-win_amd64.whl
Collecting kiwisolver>=1.0.1 (from matplotlib==3.0.0)
Downloading (57kB)
100% |████████████████████████████████| 61kB 55kB/s
Collecting python-dateutil>=2.1 (from matplotlib==3.0.0)
Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)
100% |████████████████████████████████| 215kB 74kB/s
Collecting cycler>=0.10 (from matplotlib==3.0.0)
Downloading
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib==3.0.0)
Downloading (57kB)
100% |████████████████████████████████| 61kB 131kB/s
Requirement already satisfied: numpy>=1.10.0 in c:\program files\python37\lib\site-packages (from matplotlib==3.0.0) (1.15.2)
Requirement already satisfied: setuptools in c:\program files\python37\lib\site-packages (from kiwisolver>=1.0.1->matplotlib==3.0.0) (39.0.1)
Collecting six>=1.5 (from python-dateutil>=2.1->matplotlib==3.0.0)
Downloading
Installing collected packages: kiwisolver, six, python-dateutil, cycler, pyparsing, matplotlib
Successfully installed cycler-0.10.0 kiwisolver-1.0.1 matplotlib-3.0.0 pyparsing-2.2.2 python-dateutil-2.7.3 six-1.11.0
Scikit-Learn:
A set of python modules for machine learning and data mining.
scikit-learn(簡記sklearn)是用python實現的機器學習演算法庫。sklearn可以實現資料預處理、分類、迴歸、降維、模型選擇等常用的機器學習演算法。sklearn是基於NumPy, SciPy, matplotlib的。
安裝:
C:\Program Files\Python37\Scripts>pip install d:\scikit_learn-0.20.0-cp37-cp37m-win_amd64.whl
Processing d:\scikit_learn-0.20.0-cp37-cp37m-win_amd64.whl
Requirement already satisfied: scipy>=0.13.3 in c:\program files\python37\lib\site-packages (from scikit-learn==0.20.0) (1.1.0)
Requirement already satisfied: numpy>=1.8.2 in c:\program files\python37\lib\site-packages (from scikit-learn==0.20.0) (1.15.2)
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.20.0
可以簡單測試一下演算法庫安裝後的效果,程式碼如下:
#匯入NumPy庫 import numpy as np #匯入Matplotlib庫 import matplotlib.pyplot as plt import math #定義序列端點和樣本數 x = np.linspace(-math.pi, math.pi, 100) #定義函式 y0 = x / x - 1 y1 = np.sin(x) y2 = np.cos(x) y3 = x**2 - 2 * x - 1 #繪製曲線 plt.plot(x, y0, color = 'black', linewidth = 0.5) plt.plot(x, y1, label = '$y=sin(x)$', color = 'red', linewidth = 0.5) plt.plot(x, y2, label = '$y=cos(x)$', color = 'green', linewidth = 0.5) plt.plot(x, y3, label = '$y=x^2-2x+1$', color = 'blue', linewidth = 0.5) #定義座標 plt.xlabel('Time(s)') plt.ylabel('Volt') plt.xlim(-4, 4) plt.ylim(-2, 2) #標題和圖示 plt.title('PyPlot') plt.legend() #顯示繪圖 plt.show()
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28974745/viewspace-2219307/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Anaconda安裝Python的seaborn庫Python
- python庫批量安裝的方法Python
- Python安裝graphics庫Python
- Ubuntu 下安裝Python庫UbuntuPython
- python 如何安裝numpy庫?Python
- python資料庫-MongoDB的安裝(53)Python資料庫MongoDB
- Python庫安裝教程之NumpyPython
- Python3安裝requests庫Python
- Python技術分享:numpy庫的安裝教程Python
- Windows下dlib庫python安裝(CUDA)WindowsPython
- 在python docker中安裝ESL庫PythonDocker
- Pycharm安裝dlib庫(Python3.8)PyCharmPython
- python ----python的安裝Python
- 將本地安裝的Python庫整合到Docker映象PythonDocker
- Python 庫/模組的pip安裝和IPython的使用Python
- Python庫檢查是否正確安裝並安裝所需版本Python
- 練習安裝Python擴充套件庫Python套件
- python庫怎麼檢查和安裝?Python
- Python pip的安裝及解除安裝Python
- python安裝MySQL庫引出的一些問題PythonMySql
- Eigen庫的安裝
- 【python】python安裝Python
- Python爬蟲--- 1.2 BS4庫的安裝與使用Python爬蟲
- 安裝 Lua 的 HTTP 庫HTTP
- python安裝Python
- python怎麼安裝第三方庫Python
- Anaconda管理多Python版本下安裝庫檔案Python
- python資料庫-安裝問題總結(48)Python資料庫
- Python的安裝和使用Python
- Visual Studio Code中Python安裝庫檔案遇到的問題Python
- Python中的selenium的安裝Python
- 安裝 Dispatch 庫
- Python安裝教程(非常詳細) python如何安裝使用Python
- Python-第三方庫打包與安裝Python
- Python匯出和安裝第三方庫Python
- xgboost的作用與庫的安裝
- Python安裝教程Python
- Docker 安裝 pythonDockerPython