Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install flask-mysqldb

I've been trying to install flask-mysqldb using pip install flask-mysqldb, but every time I try it gives me an error that says :

error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe' failed with exit status 2

I've looked around a lot and no answer works for me. I searched the file in https://www.lfd.uci.edu/~gohlke/pythonlibs/ but its not there.

I am on Windows 7 x64.

like image 687
Joaquín Laks Avatar asked Jan 19 '26 11:01

Joaquín Laks


2 Answers

Of course you can not find whl for flask-mysqldb, but you can find mysqlclient.

Download suitable version for you platform from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

Then, e.g. pip install mysqlclient-1.3.13-cp27-cp27m-win32.whl, depends what you download.

Finally, pip install flask-mysqldb again, this will work for you.

like image 137
atline Avatar answered Jan 21 '26 01:01

atline


the same issue/problem I've also received, That is flask_mysqldb 'no module'
first of all flask_mysqldb isn't installed through pip, You have to install a suitable version for mysqlclient
for me it worked
I'm using window 10 having python3.8 installed....... to rectfiy the error use the follwing procedure:
click on the link
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and select mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl (python3.8 a suitable version for me) download it then search for the directory where downloaded ..... and then through command prompt type

pip install mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl 

and then

pip install flask_mysqldb 

and done

like image 32
Ziar Khan Avatar answered Jan 21 '26 00:01

Ziar Khan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!