1

Hi,

Im trying to pip install mysql-python and I keep getting an error. I was wondering if anyone knows what I need to do get this working?

I'm using Windows 10, python 3.6 and mysql 5.7. I'm new to coding so if there is something I missed please let me know. Thanks

This is the error I keep getting:

_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory

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

DarkSuniuM
  • 2,523
  • 2
  • 26
  • 43
  • I suggest you to use `PyMySQL` instead on windows, also u can use `mysqlclient` – DarkSuniuM Mar 10 '18 at 04:44
  • Would I still be able to write and pull data from MySQL using this method? I was trying to follow a text book for my first example. – user9463976 Mar 10 '18 at 04:52
  • Yes you'll be able to do that! [Check this link](https://github.com/PyMySQL/PyMySQL) – DarkSuniuM Mar 10 '18 at 04:54
  • Possible duplicate of [Can't install mysql-python (newer versions) in Windows](https://stackoverflow.com/questions/37092125/cant-install-mysql-python-newer-versions-in-windows) – Alex R Sep 27 '18 at 00:53

1 Answers1

0

You can download unofficial windows binaries for your python version using https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient.Then install it using pip. This way you'll be able to avoid the hassle of dealing with visual studio build tools.

Just download the mysqlclient.whl file most applicable to you(for python 3 versions).

I think in your case it'll be

mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl(if your machine is 32 bits) mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl(if your machine is 64 bits)

and then in command prompt, change the location to the directory where the downloaded file is, by :

cd "the path to the downloaded file"

and run the file:

pip install mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
Tharushi Geethma
  • 1,249
  • 15
  • 21