Featured image of post pip安装mysqliclient报错  fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory

pip安装mysqliclient报错 fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory

PIP安装mysqliclient报错问题

pip安装mysqliclient报错 fatal error C1083: 无法打开包括文件: “mysql.h”: No such file or directory

出现这个错误的原因是本地没有配置mysql-connector-c的path,也就是说mysqlclient依赖的头文件是lib库没有找到。
注意:我本地安装的是visual studio 2019

  1. 下载mysql-connector的c语言api

下载地址:https://downloads.mysql.com/archives/c-c/

我下载的是Windows (x86, 64-bit), ZIP Archive版,如果下载MSI Installer安装版,可以直接安装以省去下面的步骤。

  1. 解压缩后把include的所有头文件复制到Visual studio的MSVC编译器的include中

  1. mysqlclient.lib更名为mariadbclient.lib,然后把mariadbclient.lib复制到MSVC的lib中(由于我的是64bit,因此我放在x64中)

需要注意自己的路径

  1. 安装mysqlclient
1
pip install -U mysqlclient

Successfully!!!!

使用 Hugo 构建
主题 StackJimmy 设计