windows安装Mysql-python出错:LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externals

首先喷一句:windows下搞开发真的环境很蛋疼....

出现标题的这个错误,怎么解决呢?

直接去这里下载mysqlclient:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
选择与你相匹配的版本.
比如:你是windows 64位,python是2.7.x版本,且为64位.那么就下载
mysqlclient-1.3.12-cp27-cp27m-win_amd64.whl
如果是3.5或者是3.6的就选择相应版本,简单的图示如下:

windows安装Mysql-python出错:LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externals_第1张图片
版本简明图

然后在cmd里面通过cd命令切换到你下载的mysqlclient所在文件夹,然后执行
pip install mysqlclient-1.3.12-cp27-cp27m-win_amd64.whl
安装完提示success字样,即表明安装成功了.
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.3.12
最后进入python交互式命令界面测试一下:
import MySQLdb
如果没有报错就成功了.

参考文章:
https://stackoverflow.com/questions/38801209/error-installing-mysql-python-and-none-of-mentioned-solutions-worked

你可能感兴趣的:(windows安装Mysql-python出错:LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externals)