1. 程式人生 > >python2安裝Flask-MySQLdb出現 fatal error C1083: Cannot open include file: 'mysql.h': No su ch file or directory

python2安裝Flask-MySQLdb出現 fatal error C1083: Cannot open include file: 'mysql.h': No su ch file or directory

cto soft inf programs -m .whl 分享圖片 admin can

錯誤具體內容如下:

_mysql.c(29) : fatal error C1083: Cannot open include file: ‘mysql.h‘: No such file or directory
error: command ‘C:\\Users\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe‘ failed with exit status 2

弄了兩個多小時,才弄好,整理了一下解決辦法如下:(我的環境是win7 64位系統,python2.7 32位版本)

1.先貼個網站https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python,東西都在這個網站下就行

2.先安裝MySQL-python,即在上述網站下載MySQL_python?1.2.5?cp27?none?win32.whl,64位的話下載MySQL_python?1.2.5?cp27?none?win_amd64.whl,然後pip即可(不會pip的同學自行百度一下這個吧)

3.然後安裝mysqlclient,下載對應版本的whl文件,我用的是mysqlclient?1.3.12?cp27?cp27m?win32.whl,然後pip

4.之後再pip Flask-MySQLdb即可

5.最後貼一下我成功圖,預祝大家成功

技術分享圖片

python2安裝Flask-MySQLdb出現 fatal error C1083: Cannot open include file: 'mysql.h': No su ch file or directory