1. 程式人生 > >關於在Python3.6下安裝MySQL-python模組的問題

關於在Python3.6下安裝MySQL-python模組的問題

關於在Python3.6下安裝MySQL-python模組的問題

安裝MySQL-python模組,一開始百度到用pip安裝:

pip install MySQL-python

 

但是在安裝的時候卻報錯了:

 

mysql.c(42): fatal error C1083: 無法開啟包括檔案: “config-win.h”: No such file or directory
error: command 'D:\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

 

適合在Python-3.5上擴充套件的mysql驅動

https://pypi.python.org/pypi/mysqlclient/1.3.10

下載後*.whl檔案放在Scripts目錄

然後用cmd命令進入到這個目錄執行PIP命令安裝:

 

pip install xxxx.whl

提示:

Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.3.10

開啟pycharm,在檔案匯入模組:

import MySQLdb

沒有報錯提示MySQLdb模組找不到,說明安裝成功!