3

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.

atline
  • 28,355
  • 16
  • 77
  • 113
Joaquín Laks
  • 53
  • 1
  • 1
  • 6

4 Answers4

7

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.

atline
  • 28,355
  • 16
  • 77
  • 113
1

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

Raj Paliwal
  • 943
  • 1
  • 9
  • 22
Ziar Khan
  • 301
  • 3
  • 3
0

I had the same problem

I was using python 3.8 and it's not supported by this package. https://flask-mysqldb.readthedocs.io/en/latest/ : Flask-MySQLdb is compatible with and tested on Python 2.7, 3.5, 3.6 and 3.7

I recreated a virtual environment with python 3.7 and it all worked.

installing above must be made

0

For Windows

install pip install wheel

after go to on your browser ' https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python '

find the appropriate package for the python version and download.

and copy that file to C:\Users<your-computer-name> .

go to cmd again and write here pip install flask-mysqldb

prenszuko
  • 49
  • 2
  • "find the appropriate package for the python version and download", could you please clarify what library? – chomp Apr 03 '21 at 00:24