Akash senta
Akash senta

Reputation: 493

pip install mysqlclient on win64 not working giving error 'Cannot open file: 'mysql.h'

I am trying to use mysql with python SQLAlchemy but while installing mysqlclient for python its giving error. kindly check details below:

mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2

Upvotes: 0

Views: 752

Answers (2)

Akash senta
Akash senta

Reputation: 493

I just got an answer by looking at other options mentioned here. Actually mistake was that,

  • I have installed Python 3.7.4 with 32 bits on 64bits machine.
  • Code was looking for below path but it was going to the wrong path in program files instead of program files(x86)

C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib

I have installed a new Python with 3.7 with 64 bits and also while installing MySQL connector I have changed the path of installation to the above-mentioned path and now it's working fine.

Thank you, everyone, for your time and help

Upvotes: 0

Reyhaneh Torab
Reyhaneh Torab

Reputation: 367

based on this Answer, you can download unofficial windows binaries for your python version using https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. for example, "mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl". Then install it using pip.

pip install "path to the downloaded .whl file"

Note: In the name of the wheels, there are numbers that show this wheel is for which python version. for example if only you have python version 3.6, you can use "mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl". After all, if you still have error, try 32bit version of wheels.

Upvotes: 0

Related Questions