Home > Database > Mysql Tutorial > How to Fix 'Missing 'mysql.h' Header File' Error When Installing mysqlclient with pip?

How to Fix 'Missing 'mysql.h' Header File' Error When Installing mysqlclient with pip?

DDD
Release: 2025-01-10 14:32:46
Original
583 people have browsed it

How to Fix

pip install mysqlclient error: 'mysql.h' header file is missing

Question:

Using pip to install the mysqlclient library failed with the error: "fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory."

Solution:

Building the mysqlclient extension on Windows systems requires the mysql.h header file. To work around this issue, you can download unofficial Windows binaries that work with specific Python versions.

Steps to install unofficial Windows binaries:

  1. Visit the following website: https://www.php.cn/link/b27c40f1f7fb35fcf65d89dc29748e29

  2. Find the binary that best suits your version of Python (for example, mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl).

  3. Download the .whl file.

  4. Install the downloaded binaries using pip:

    <code class="language-bash">pip install "下载文件的路径"</code>
    Copy after login

Example:

To install unofficial Windows binaries for 64-bit Python 3.6, download the mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl file. Then, run in command prompt or terminal:

<code class="language-bash">pip install mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl</code>
Copy after login

The above is the detailed content of How to Fix 'Missing 'mysql.h' Header File' Error When Installing mysqlclient with pip?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template