Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling mysql-python on Windows with PIP

So I have Python 2.7 and setuptools installed on my Windows 7 laptop. I also have Visual Studio 2008 Express installed and MySQL with dev tools.

I am trying to install mysql-python via pip like:

pip install mysql-python

I am getting link errors:

   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

Any ideas how to solve this issue? Thanks

like image 622
Richard Knop Avatar asked Jul 03 '14 11:07

Richard Knop


1 Answers

I had the same problem and exact same errors.I don't know why but

pip install Mysql-python

gave errors. But when I tried

easy_install Mysql-python

It worked.I don't know why but it did work but would love to know why.

like image 185
user3894045 Avatar answered Oct 13 '22 19:10

user3894045