首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用PIP在Windows上编译mysql-python

用PIP在Windows上编译mysql-python
EN

Stack Overflow用户
提问于 2014-07-03 19:32:01
回答 4查看 4.2K关注 0票数 18

所以我在我的Windows7笔记本电脑上安装了Python 2.7和setuptools。我还安装了Visual Studio2008Express和带有开发工具的MySQL。

我正在尝试通过pip安装mysql-python,如下所示:

代码语言:javascript
运行
复制
pip install mysql-python

我收到链接错误:

代码语言:javascript
运行
复制
   Creating library build\temp.win32-2.7\Release\_mysql.lib and object build\temp.win32-2.7\Release\_mysql.exp

_mysql.obj : error LNK2019: unresolved external symbol _mysql_error@4 referenced in function __mysql_Exception

_mysql.obj : error LNK2019: unresolved external symbol _mysql_errno@4 referenced in function __mysql_Exception

_mysql.obj : error LNK2019: unresolved external symbol _mysql_server_init@12 referenced in function __mysql_server_init

_mysql.obj : error LNK2019: unresolved external symbol _mysql_server_end@0 referenced in function __mysql_server_end

_mysql.obj : error LNK2019: unresolved external symbol _mysql_thread_safe@0 referenced in function __mysql_thread_safe

_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_fields@4 referenced in function __mysql_ResultObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_fields@4 referenced in function __mysql_ResultObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_field_count@4 referenced in function __mysql_ResultObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_store_result@4 referenced in function __mysql_ResultObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_use_result@4 referenced in function __mysql_ResultObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function __mysql_ConnectionObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_ssl_set@24 referenced in function __mysql_ConnectionObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_options@12 referenced in function __mysql_ConnectionObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function __mysql_ConnectionObject_Initialize

_mysql.obj : error LNK2019: unresolved external symbol _mysql_close@4 referenced in function __mysql_ConnectionObject_close

_mysql.obj : error LNK2019: unresolved external symbol _mysql_affected_rows@4 referenced in function __mysql_ConnectionObject_affected_rows

_mysql.obj : error LNK2019: unresolved external symbol _mysql_debug@4 referenced in function __mysql_debug

_mysql.obj : error LNK2019: unresolved external symbol _mysql_dump_debug_info@4 referenced in function __mysql_ConnectionObject_dump_debug_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_autocommit@8 referenced in function __mysql_ConnectionObject_autocommit

_mysql.obj : error LNK2019: unresolved external symbol _mysql_commit@4 referenced in function __mysql_ConnectionObject_commit

_mysql.obj : error LNK2019: unresolved external symbol _mysql_rollback@4 referenced in function __mysql_ConnectionObject_rollback

_mysql.obj : error LNK2019: unresolved external symbol _mysql_next_result@4 referenced in function __mysql_ConnectionObject_next_result

_mysql.obj : error LNK2019: unresolved external symbol _mysql_set_server_option@8 referenced in function __mysql_ConnectionObject_set_server_option

_mysql.obj : error LNK2019: unresolved external symbol _mysql_sqlstate@4 referenced in function __mysql_ConnectionObject_sqlstate

_mysql.obj : error LNK2019: unresolved external symbol _mysql_warning_count@4 referenced in function __mysql_ConnectionObject_warning_count

_mysql.obj : error LNK2019: unresolved external symbol _mysql_escape_string@12 referenced in function __mysql_escape_string

_mysql.obj : error LNK2019: unresolved external symbol _mysql_real_escape_string@16 referenced in function __mysql_escape_string

_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_lengths@4 referenced in function __mysql_row_to_tuple

_mysql.obj : error LNK2019: unresolved external symbol __imp__strncpy referenced in function __mysql_row_to_dict

_mysql.obj : error LNK2019: unresolved external symbol __imp__strncat referenced in function __mysql_row_to_dict

_mysql.obj : error LNK2019: unresolved external symbol _memset referenced in function __mysql_row_to_dict_old

_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_row@4 referenced in function __mysql__fetch_row

_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_rows@4 referenced in function __mysql_ResultObject_fetch_row

_mysql.obj : error LNK2019: unresolved external symbol _mysql_change_user@16 referenced in function __mysql_ConnectionObject_change_user

_mysql.obj : error LNK2019: unresolved external symbol _mysql_character_set_name@4 referenced in function __mysql_ConnectionObject_character_set_name

_mysql.obj : error LNK2019: unresolved external symbol _mysql_set_character_set@8 referenced in function __mysql_ConnectionObject_set_character_set

_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_character_set_info@8 referenced in function __mysql_ConnectionObject_get_character_set_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_client_info@0 referenced in function __mysql_get_client_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_host_info@4 referenced in function __mysql_ConnectionObject_get_host_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_proto_info@4 referenced in function __mysql_ConnectionObject_get_proto_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_server_info@4 referenced in function __mysql_ConnectionObject_get_server_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_info@4 referenced in function __mysql_ConnectionObject_info

_mysql.obj : error LNK2019: unresolved external symbol _mysql_insert_id@4 referenced in function __mysql_ConnectionObject_insert_id

_mysql.obj : error LNK2019: unresolved external symbol _mysql_kill@8 referenced in function __mysql_ConnectionObject_kill

_mysql.obj : error LNK2019: unresolved external symbol _mysql_ping@4 referenced in function __mysql_ConnectionObject_ping

_mysql.obj : error LNK2019: unresolved external symbol _mysql_real_query@12 referenced in function __mysql_ConnectionObject_query

_mysql.obj : error LNK2019: unresolved external symbol _mysql_select_db@8 referenced in function __mysql_ConnectionObject_select_db

_mysql.obj : error LNK2019: unresolved external symbol _mysql_shutdown@8 referenced in function __mysql_ConnectionObject_shutdown

_mysql.obj : error LNK2019: unresolved external symbol _mysql_stat@4 referenced in function __mysql_ConnectionObject_stat

_mysql.obj : error LNK2019: unresolved external symbol _mysql_thread_id@4 referenced in function __mysql_ConnectionObject_thread_id

_mysql.obj : error LNK2019: unresolved external symbol __imp__sprintf referenced in function __mysql_ConnectionObject_repr

_mysql.obj : error LNK2019: unresolved external symbol _mysql_data_seek@12 referenced in function __mysql_ResultObject_data_seek

_mysql.obj : error LNK2019: unresolved external symbol _mysql_row_seek@8 referenced in function __mysql_ResultObject_row_seek

_mysql.obj : error LNK2019: unresolved external symbol _mysql_row_tell@4 referenced in function __mysql_ResultObject_row_seek

_mysql.obj : error LNK2019: unresolved external symbol _mysql_free_result@4 referenced in function __mysql_ResultObject_dealloc

LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12

build\lib.win32-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externals

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\link.exe' failed with exit status 1120

有什么办法解决这个问题吗?谢谢

EN

回答 4

Stack Overflow用户

发布于 2016-02-04 00:10:14

我也有同样的问题和错误。我不知道为什么,但是

代码语言:javascript
运行
复制
pip install Mysql-python

给出错误。但当我试着

代码语言:javascript
运行
复制
easy_install Mysql-python

它起作用了。我不知道为什么,但它确实起作用了,但我想知道为什么。

票数 5
EN

Stack Overflow用户

发布于 2015-10-22 23:35:48

检查这两者是否都是32位64位,并且它们之间没有不匹配。当我遇到这个问题时,是因为我安装了64位的Python,但安装了32位的MySQL。因此,pip安装程序无法找到要链接的匹配二进制文件,因此失败并显示此消息。解决这个问题很简单,只需在上面安装32位Python,一切都可以正常工作。

请注意,也可以将MySQL更新为64位,但目前MySQL的安装程序似乎只有32位。您可以通过从MySQL官方网站下载的.zip文件进行安装,尽管其中包含64位二进制文件。

要找出您已经安装了哪一个:

对于

  • Python,只需转到命令行并键入python。它应该会显示win32上的版本,以及是32位还是64位安装,如Python2.7.10(默认,2015年5月23日09:40:32) MSC v.1500 32位(英特尔

对于

  • MySQL,最简单的方法可能是将其安装在哪个文件夹中。如果安装到Program Files/,则为64位,但如果安装到Program Files (x86)/,则为32位
票数 4
EN

Stack Overflow用户

发布于 2015-10-22 20:42:13

您的安装似乎没有检测到mysql客户端库。从mysql安装中找到mysqlcppconn.dll并将其复制到构建脚本可以读取的文件夹中,例如windows文件夹。有关更多信息,请查看此链接https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-apps-windows-visual-studio.html#connector-cpp-application-build-dynamic

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24552593

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档