Joaquín Laks
Joaquín Laks

Reputation: 53

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.

Upvotes: 3

Views: 26017

Answers (4)

prenszuko
prenszuko

Reputation: 55

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

Upvotes: 0

Cyril Moysset
Cyril Moysset

Reputation: 21

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

Upvotes: 0

Ziar Khan
Ziar Khan

Reputation: 321

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

Upvotes: 1

atline
atline

Reputation: 31574

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.

Upvotes: 7

Related Questions