官網操做教程:http://www.runoob.com/python3/python3-mysql.htmlhtml
一、簡介python
PyMySQL 是在 Python3.x 版本中用於鏈接 MySQL 服務器的一個庫,Python2中則使用mysqldb。mysql
PyMySQL 遵循 Python 數據庫 API v2.0 規範,幷包含了 pure-Python MySQL 客戶端庫。git
二、PyMySQL安裝github
在使用 PyMySQL 以前,咱們須要確保 PyMySQL 已安裝。sql
PyMySQL 下載地址:https://github.com/PyMySQL/PyMySQL。數據庫
若是還未安裝,咱們能夠使用如下命令安裝最新版的 PyMySQL:服務器
pip3 install PyMySQL
出現錯誤,提示須要更新pippost
更新pip:ui
pip install --upgrade pip
繼續安裝PyMySQL:
pip3 install PyMySQL
出現如下錯誤的話,重啓就行了:
sudo reboot
這個時候一直卡在Building wheels for collected package:cryptography, cffi, pycparser。
解決辦法參考:
過程也是心酸
再次執行安裝PyMySQL:
pip3 install PyMySQL
大功告成!!!