在用python操作mysql時報錯:ModuleNotFoundError- No module named 'MySQLdb'
阿新 • • 發佈:2019-02-09
用Flask+python+mysql寫一個小專案
系統 win10
py版本:3.6.1
在配置資料庫時報錯ModuleNotFoundError: No module named 'MySQLdb'
from blog import db db.create_all()
報錯資訊是 缺少模組MYSQLdb,於是安裝庫mysqldb
C:\WINDOWS\system32>py -3 -m pip install mysqldb
Collecting mysqldb
Could not find a version that satisfies the requirement mysqldb (from versions: )
No matching distribution found for mysqldb
很明顯不成功(我也很無奈~~)
顯然不是缺少這個模組,查詢資料
需要安裝setuptool和mysqlclient
在安裝mysqlclient的時候繼續報錯
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
c++14.0 ?OMG這個需要6個G磁碟空間,找一下臨時替代品吧,pymssql-2.1.3-cp36-cp36m-win_amd64.whl是個不錯的選擇