使用PIP在Windows上编译mysql-python

前端之家收集整理的这篇文章主要介绍了使用PIP在Windows上编译mysql-python前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
所以我在我的Windows 7笔记本电脑上安装了Python 2.7和setuptools。我还安装了Visual Studio 2008 Express和MysqL与开发工具。

我试图通过pip安装MysqL-python:

pip install MysqL-python

我得到链接错误

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

任何想法如何解决这个问题?谢谢

检查两者是32位还是64位,并且它们之间没有不匹配。当我遇到这个问题的时候,是因为我安装了一个64位的Python,但是安装了一个32位的MysqL。因此,pip安装程序可能无法找到要链接到的匹配二进制文件,并且此消息失败。解决这个问题只是一个将顶级的32位Python安装在一起的问题,一切正常。

请注意,也可能将MysqL更新为64位,但目前MysqL的安装程序似乎只有32位。您可以通过从官方MysqL站点下载的.zip文件进行安装,尽管它具有64位二进制文​​件。

了解您已安装的:

>对于Python,只需转到命令行并键入python。它应该显示什么版本,如果它是一个32位或64位安装如此

Python 2.7.10 (default,May 23 2015,09:40:32) [MSC v.1500 32 bit (Intel)] on win32

>对于MysqL,最简单的方法可能是安装在哪个文件夹中。如果安装到Program Files /,那么它是64位,但如果安装到Program Files(x86)/它是32位

猜你在找的Windows相关文章