windows安装mysqlclient2.1.1踩坑记录
- 注意
- 安装vistual studio ,一定要安装,建议选择默认设置
- warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
- LINK : fatal error LNK1181: 无法打开输入文件“mariadbclient.lib”error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181
注意
在安装mysqlclient之前一定要查看安装的mysqlclient版本和python的版本对应关系,地址:https://pypi.org/project/mysqlclient/2.1.1/#history
安装vistual studio ,一定要安装,建议选择默认设置
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.error: command ‘C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe’ failed with exit code 2
一定是vistual studio 少安装文件,重新安装即可
LINK : fatal error LNK1181: 无法打开输入文件“mariadbclient.lib”error: command ‘C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\link.exe’ failed with exit status 1181
-
安装MySQL Connector6.1 https://downloads.mysql.com/archives/c-c/
-
在C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include下或者C:\Program Files \MySQL\MySQL Connector C 6.1\include 下新建
mariadb目录 -
将C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\vs14或者C:\Program Files \MySQL\MySQL Connector C 6.1\lib\vs14 下的mysqlclient.lib 改成
mariadbclient.lib 并将修改后的文件复制到mariadb目录 -
执行pip install mysqlclient==版本 即可