0

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

  • I'm running this on Windows 10 64 bit and Anaconda Python 3.7.4
  • I have tried by installing another python version as well but no luck.
  • Tried to install MYSQL connector c++ as well. but still not working.
  • If I run code 'pip install mysqlclient'

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

Akash senta
  • 483
  • 7
  • 16
  • Look at answer https://stackoverflow.com/questions/51146117/installing-mysqlclient-in-python-3-6-in-windows Try to use pure python MySQL connector PyMySQL for example: https://github.com/PyMySQL/PyMySQL – Stanislav Ivanov Dec 12 '19 at 10:04

2 Answers2

0

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.

Community
  • 1
  • 1
Reyhaneh Torab
  • 360
  • 5
  • 9
0

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

Akash senta
  • 483
  • 7
  • 16