ошибка установки mysql-python и ни одно из упомянутых решений не сработало

Я просто хотел установить Mysql-python, но каждый раз появляются ошибки. Я испробовал все упомянутые решения, как установку колеса, использование easy_install, обновление Visual C ++ для Python, установку MySQL-коннектора, даже установку самой последней MySQL, и все остальное пришло мне в голову и моему разуму. У меня есть Python 2.7.11 на Windows 10. и я установил большинство обновлений Windows. всегда это происходит:

easy_install Mysql-python
Searching for Mysql-python
Reading https://pypi.python.org/simple/Mysql-python/
Best match: MySQL-python 1.2.5
Downloading https://pypi.python.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c
Processing MySQL-python-1.2.5.zip
Writing c:\users\aref\appdata\local\temp\easy_install-nhmvzf\MySQL-python-1.2.5\setup.cfg
Running MySQL-python-1.2.5\setup.py -q bdist_egg --dist-dir c:\users\aref\appdata\local\temp\easy_install-nhmvzf\MySQL-python-1.2.5\egg-dist-tmp-idut0x
_mysql.c
C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\config-win.h(203) : warning C4005: 'SIZEOF_OFF_T' : macro redefinition
        c:\python27\include\pyconfig.h(353) : see previous definition of 'SIZEOF_OFF_T'
C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\config-win.h(301) : warning C4005: 'HAVE_STDDEF_H' : macro redefinition
        c:\python27\include\pyconfig.h(693) : see previous definition of 'HAVE_STDDEF_H'
_mysql.c(287) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(317) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(470) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1168) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1274) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1466) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1468) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1504) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1506) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1532) : warning C4018: '<' : signed/unsigned mismatch
_mysql.c(2302) : warning C4244: 'function' : conversion from '__int64' to 'long', possible loss of data
_mysql.obj : warning LNK4197: export 'init_mysql' specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\_mysql.lib and object build\temp.win-amd64-2.7\Release\_mysql.exp
_mysql.obj : error LNK2019: unresolved external symbol mysql_error referenced in function _mysql_Exception
_mysql.obj : error LNK2019: unresolved external symbol mysql_errno referenced in function _mysql_Exception
_mysql.obj : error LNK2019: unresolved external symbol mysql_server_init referenced in function _mysql_server_init
_mysql.obj : error LNK2019: unresolved external symbol mysql_server_end referenced in function _mysql_server_end
_mysql.obj : error LNK2019: unresolved external symbol mysql_thread_safe referenced in function _mysql_thread_safe
_mysql.obj : error LNK2019: unresolved external symbol mysql_fetch_fields referenced in function _mysql_ResultObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_num_fields referenced in function _mysql_ResultObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_field_count referenced in function _mysql_ResultObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_store_result referenced in function _mysql_ResultObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_use_result referenced in function _mysql_ResultObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_real_connect referenced in function _mysql_ConnectionObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_ssl_set referenced in function _mysql_ConnectionObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_options referenced in function _mysql_ConnectionObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_init referenced in function _mysql_ConnectionObject_Initialize
_mysql.obj : error LNK2019: unresolved external symbol mysql_close referenced in function _mysql_ConnectionObject_close
_mysql.obj : error LNK2019: unresolved external symbol mysql_affected_rows referenced in function _mysql_ConnectionObject_affected_rows
_mysql.obj : error LNK2019: unresolved external symbol mysql_debug referenced in function _mysql_debug
_mysql.obj : error LNK2019: unresolved external symbol mysql_dump_debug_info referenced in function _mysql_ConnectionObject_dump_debug_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_autocommit referenced in function _mysql_ConnectionObject_autocommit
_mysql.obj : error LNK2019: unresolved external symbol mysql_commit referenced in function _mysql_ConnectionObject_commit
_mysql.obj : error LNK2019: unresolved external symbol mysql_rollback referenced in function _mysql_ConnectionObject_rollback
_mysql.obj : error LNK2019: unresolved external symbol mysql_next_result referenced in function _mysql_ConnectionObject_next_result
_mysql.obj : error LNK2019: unresolved external symbol mysql_set_server_option referenced in function _mysql_ConnectionObject_set_server_option
_mysql.obj : error LNK2019: unresolved external symbol mysql_sqlstate referenced in function _mysql_ConnectionObject_sqlstate
_mysql.obj : error LNK2019: unresolved external symbol mysql_warning_count referenced in function _mysql_ConnectionObject_warning_count
_mysql.obj : error LNK2019: unresolved external symbol mysql_escape_string referenced in function _mysql_escape_string
_mysql.obj : error LNK2019: unresolved external symbol mysql_real_escape_string referenced in function _mysql_escape_string
_mysql.obj : error LNK2019: unresolved external symbol mysql_fetch_lengths referenced in function _mysql_row_to_tuple
_mysql.obj : error LNK2019: unresolved external symbol __imp_strncat referenced in function _mysql_row_to_dict
_mysql.obj : error LNK2019: unresolved external symbol __imp_strncpy 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 referenced in function _mysql__fetch_row
_mysql.obj : error LNK2019: unresolved external symbol mysql_num_rows referenced in function _mysql_ResultObject_fetch_row
_mysql.obj : error LNK2019: unresolved external symbol mysql_change_user referenced in function _mysql_ConnectionObject_change_user
_mysql.obj : error LNK2019: unresolved external symbol mysql_character_set_name referenced in function _mysql_ConnectionObject_character_set_name
_mysql.obj : error LNK2019: unresolved external symbol mysql_set_character_set referenced in function _mysql_ConnectionObject_set_character_set
_mysql.obj : error LNK2019: unresolved external symbol mysql_get_character_set_info referenced in function _mysql_ConnectionObject_get_character_set_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_get_client_info referenced in function _mysql_get_client_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_get_host_info referenced in function _mysql_ConnectionObject_get_host_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_get_proto_info referenced in function _mysql_ConnectionObject_get_proto_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_get_server_info referenced in function _mysql_ConnectionObject_get_server_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_info referenced in function _mysql_ConnectionObject_info
_mysql.obj : error LNK2019: unresolved external symbol mysql_insert_id referenced in function _mysql_ConnectionObject_insert_id
_mysql.obj : error LNK2019: unresolved external symbol mysql_kill referenced in function _mysql_ConnectionObject_kill
_mysql.obj : error LNK2019: unresolved external symbol mysql_ping referenced in function _mysql_ConnectionObject_ping
_mysql.obj : error LNK2019: unresolved external symbol mysql_real_query referenced in function _mysql_ConnectionObject_query
_mysql.obj : error LNK2019: unresolved external symbol mysql_select_db referenced in function _mysql_ConnectionObject_select_db
_mysql.obj : error LNK2019: unresolved external symbol mysql_shutdown referenced in function _mysql_ConnectionObject_shutdown
_mysql.obj : error LNK2019: unresolved external symbol mysql_stat referenced in function _mysql_ConnectionObject_stat
_mysql.obj : error LNK2019: unresolved external symbol mysql_thread_id 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 referenced in function _mysql_ResultObject_data_seek
_mysql.obj : error LNK2019: unresolved external symbol mysql_row_seek referenced in function _mysql_ResultObject_row_seek
_mysql.obj : error LNK2019: unresolved external symbol mysql_row_tell referenced in function _mysql_ResultObject_row_seek
_mysql.obj : error LNK2019: unresolved external symbol mysql_free_result referenced in function _mysql_ResultObject_dealloc
LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externals
error: Setup script exited with error: command 'C:\\Users\\aref\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1120

Спасибо за помощь

 Sergio Ramalli Gomes26 нояб. 2017 г., 13:57
Просто добавлю, что лично я продолжал получать ошибки, когда пробовал другие решения, найденные в git и stack. Но как только я установил mysqlclient, а затем попытался «импортировать MySQLdb» в коде, он работал, несмотря на ошибки в терминале stackoverflow.com/a/42067480/3680309 +1 для меня
 user661365806 авг. 2016 г., 09:25
Я наконец-то перешел с python 2.7.11 на 2.7.12, и мои нерешенные проблемы решаются также этой ошибкой дампа ..

Ответы на вопрос(2)

что и у вас, ни один из других ответов, похоже, не работает для меня,

напримерКомпиляция mysql-python на Windows с PIP

Это вариант другого ответа, который работал

pip install mysqlclient«import MySQLdb» теперь должен работать в коде

Кроме того, вы можете добавить этот код

try:

    import MySQLdb as mysql

except Exception as e:

    import os 
    os.system("pip install mysqlclient")
    import MySQLdb as mysql

db = mysql.connect(host=host, user=user, passwd=passwd, db=db);

У меня такая же проблема. Вот что я сделал, чтобы решить это:

Скачать mysqlclient whl файл сhttp://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient (например, если у вас есть Python 3.6 на Win64, загрузите mysqlclient ‑ 1.3.9 ‑ cp36 ‑ cp36m ‑ win_amd64.whl).

pip install mysqlclient‑1.3.9‑cp36‑cp36m‑win_amd64.whl

import MySQLdb теперь должен работать в коде Python.

Ваш ответ на вопрос