1

I am trying to create a website using Django and would like to use mySQL. Thus, with the virtualenv activated, I'm using the following command :

pip install mysqlclient

This input gives the following error :

_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory

The thing is installing it on my local python version worked like a charm ,I only face this error inside virtualenv.

I'm using python 3.7, pip and setuptools are up to date. The mysqlclient version installed locally is 1.3.13.

Nasta
  • 819
  • 8
  • 21
  • Possible duplicate of [pip install mysqlclient returns "fatal error C1083: Cannot open file: 'mysql.h': No such file or directory](https://stackoverflow.com/questions/51294268/pip-install-mysqlclient-returns-fatal-error-c1083-cannot-open-file-mysql-h) – phd Sep 13 '18 at 15:43
  • https://stackoverflow.com/search?q=%5Bpip%5D+Cannot+open+include+file%3A+%27mysql.h%27%3A+No+such+file+or+directory – phd Sep 13 '18 at 15:43

1 Answers1

5

You can try these things for windows 64-bit:

If 64 bits versions are not working you can alternatively use the 32 bits versions :

For python 3.x:

pip install mysqlclient‑1.3.13‑cp37‑cp37m‑win32.whl

For python 2.7:

pip install mysqlclient‑1.3.13‑cp27‑cp27m‑win32.whl
Nasta
  • 819
  • 8
  • 21
Agile_Eagle
  • 1,710
  • 3
  • 13
  • 32
  • I'm getting the error "mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform." with this version. Using the 32 bits version worked out. Thanks. – Nasta Sep 13 '18 at 14:14
  • Great answer. Seems like the only viable way to install mysqlclient is by first downloading it and installing it offline with the specific mysqlclient for your machine architecture and the python version installed on your platform. – Joseph May 24 '19 at 13:29
  • This answer saved my butt - just mke sure you download the correct WHL (Wheel) file for your current Python version and 32/64 type. – Jorge Oct 22 '20 at 03:51