Problem with pip install mysqlclient

I started a project with django and python 12.0. I’m usig visual code studio by the way.that’s the message error I got: src/MySQLdb/_mysql.c(29): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: “mysql.h”: No such file or directory
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe’ failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient
ERROR: Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects
WARNING: There was an error checking the latest version of pip.

Think you in advance for the help

CPython versions tested on:

Operating systems tested on:


It is Python 3.12, not 12.0 (Python version numbers don’t work that way).

If I put django python3.12 into a search engine, I see a lot of information on the Django website about the problem. For example, the bug tracker tells us that we must use the new Django version (4.2) in order to support Python 3.12.

mysqlclient need C language support, and sorry I don’t know how to add these support in MS windows.
You can try pymysql as a alternative of mysqlclient, since pymysql is implement by pure python.

I solved this issue by using Python 3.10.

Install it from:

If you want to run two (or more) versions of Python, instead of running the python command run pylauncher command py specifying which version of Python you want:

  • py -2.6 – version 2.6
  • py -2 – latest installed version 2.x
  • py -3.10 – version 3.10
  • py -3 – latest installed version 3.x

You have to do this only when creating a virtual environment. Inside venv, you can use python.