mysqldb example python visual-studio-2008 pip mysql-python

example - Compilando mysql-python en Windows con PIP



pip install mysql connector (4)

Compruebe que ambos sean de 32 bits o de 64 bits, y que no haya una discrepancia entre ellos. Cuando tuve este problema, fue porque instalé un Python de 64 bits pero tenía un MySQL de 32 bits instalado. Por lo tanto, el instalador de pip no pudo encontrar los binarios coincidentes con los que enlazar, y falló con este mensaje. Arreglar el problema era simplemente una cuestión de instalar el Python de 32 bits en la parte superior, y todo funcionó.

Tenga en cuenta que también es posible actualizar MySQL a 64 bits, pero los instaladores en este momento parecen ser solo de 32 bits. Puede instalarlo a través de un archivo .zip descargado del sitio oficial de MySQL, aunque tiene binarios de 64 bits.

Para saber cual has instalado:

  • Para Python, simplemente vaya a la línea de comandos y escriba python . Debería mostrarle qué versión y si se trata de una instalación de 32 bits o de 64 bits como tal

    Python 2.7.10 (predeterminado, 23 de mayo de 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] en win32

  • Para MySQL, la forma más sencilla es probablemente en qué carpeta está instalada. Si se instala en Program Files/ entonces es de 64 bits, pero si se instala en Program Files (x86)/ es de 32 bits

Así que tengo Python 2.7 y setuptools instalados en mi computadora portátil con Windows 7. También tengo instalado Visual Studio 2008 Express y MySQL con herramientas dev.

Estoy tratando de instalar mysql-python a través de pip como:

pip install mysql-python

Estoy recibiendo errores de enlace:

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

¿Alguna idea de cómo resolver este problema? Gracias



Intenté esto y me funcionó en la instalación de Winac de 64 bits de anaconda. escriba esto en su línea de comandos:

pip instalar mysql-python

Mi instalación funciona porque estoy usando Studio 2010.


Tuve el mismo problema y exactamente los mismos errores. No sé por qué, pero

pip install Mysql-python

Dio errores. Pero cuando lo intenté

easy_install Mysql-python

Funcionó. No sé por qué, pero funcionó, pero me encantaría saber por qué.