错误:命令“ C:\\ Program Files(x86)\\ Microsoft Visual Studio 14.0 \\ VC \\ BIN \\ x86_amd64 \\ link.exe”失败,退出状态为1120

时间:2018-07-31 15:25:25

标签: python mysql django visual-c++ command-line

我是Django的新手,我正在尝试将Django连接到MySQL数据库,而不是使用默认数据库。我在Windows7上使用Python 3.6和Django 2.0.7。我已经安装了mySQL Server 5.7。我正在虚拟环境中部署环境,但是当我尝试运行命令时:

pip install django mysqlclient

它给出了错误作为标题。以前我的错误是需要Visual c ++ 14.0,所以我安装了Visual Studio2015。但是现在它又给了另一个错误,而且我还没有看到解决此问题的明确解决方案。

using first specification
     Creating library build\temp.win-amd64-3.6\Release\_mysql.cp36-win_amd64.lib
 and object build\temp.win-amd64-3.6\Release\_mysql.cp36-win_amd64.exp
  _mysql.obj : error LNK2001: unresolved external symbol __security_check_cookie

  _mysql.obj : error LNK2001: unresolved external symbol mysql_field_count
  _mysql.obj : error LNK2001: unresolved external symbol mysql_warning_count
  _mysql.obj : error LNK2001: unresolved external symbol mysql_num_rows
  _mysql.obj : error LNK2001: unresolved external symbol mysql_shutdown
  _mysql.obj : error LNK2001: unresolved external symbol mysql_real_query
  _mysql.obj : error LNK2001: unresolved external symbol mysql_ping
  _mysql.obj : error LNK2001: unresolved external symbol mysql_stat
  _mysql.obj : error LNK2001: unresolved external symbol mysql_insert_id
  _mysql.obj : error LNK2001: unresolved external symbol mysql_next_result
  _mysql.obj : error LNK2001: unresolved external symbol mysql_ssl_set
  _mysql.obj : error LNK2001: unresolved external symbol mysql_read_query_result

  _mysql.obj : error LNK2001: unresolved external symbol mysql_get_proto_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_more_results
  _mysql.obj : error LNK2001: unresolved external symbol mysql_store_result
  _mysql.obj : error LNK2001: unresolved external symbol mysql_change_user
  _mysql.obj : error LNK2001: unresolved external symbol mysql_get_character_set
_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_commit
  _mysql.obj : error LNK2001: unresolved external symbol mysql_get_server_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_data_seek
  _mysql.obj : error LNK2001: unresolved external symbol mysql_errno
  _mysql.obj : error LNK2001: unresolved external symbol mysql_real_connect
  _mysql.obj : error LNK2001: unresolved external symbol mysql_send_query
  _mysql.obj : error LNK2001: unresolved external symbol mysql_rollback
  _mysql.obj : error LNK2001: unresolved external symbol mysql_options
  _mysql.obj : error LNK2001: unresolved external symbol mysql_real_escape_strin
g_quote
  _mysql.obj : error LNK2001: unresolved external symbol mysql_get_host_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_fetch_lengths
  _mysql.obj : error LNK2001: unresolved external symbol __imp_strncpy
  _mysql.obj : error LNK2001: unresolved external symbol mysql_affected_rows
  _mysql.obj : error LNK2001: unresolved external symbol mysql_debug
  _mysql.obj : error LNK2001: unresolved external symbol mysql_set_server_option

  _mysql.obj : error LNK2001: unresolved external symbol mysql_set_character_set

  _mysql.obj : error LNK2001: unresolved external symbol mysql_dump_debug_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_close
  _mysql.obj : error LNK2001: unresolved external symbol mysql_server_end
  _mysql.obj : error LNK2001: unresolved external symbol mysql_get_client_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_server_init
  _mysql.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vs
printf
  _mysql.obj : error LNK2001: unresolved external symbol mysql_free_result
  _mysql.obj : error LNK2001: unresolved external symbol mysql_fetch_row
  _mysql.obj : error LNK2001: unresolved external symbol mysql_thread_safe
  _mysql.obj : error LNK2001: unresolved external symbol mysql_fetch_fields
  _mysql.obj : error LNK2001: unresolved external symbol mysql_character_set_nam
e
  _mysql.obj : error LNK2001: unresolved external symbol mysql_info
  _mysql.obj : error LNK2001: unresolved external symbol mysql_escape_string
  _mysql.obj : error LNK2001: unresolved external symbol mysql_num_fields
  _mysql.obj : error LNK2001: unresolved external symbol mysql_kill
  _mysql.obj : error LNK2001: unresolved external symbol __imp_strncat
  _mysql.obj : error LNK2001: unresolved external symbol mysql_use_result
  _mysql.obj : error LNK2001: unresolved external symbol mysql_select_db
  _mysql.obj : error LNK2001: unresolved external symbol mysql_sqlstate
  _mysql.obj : error LNK2001: unresolved external symbol mysql_init
  _mysql.obj : error LNK2001: unresolved external symbol mysql_autocommit
  _mysql.obj : error LNK2001: unresolved external symbol mysql_error
  _mysql.obj : error LNK2001: unresolved external symbol mysql_thread_id
  LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
  build\lib.win-amd64-3.6\_mysql.cp36-win_amd64.pyd : fatal error LNK1120: 57 un
resolved externals
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN
\\x86_amd64\\link.exe' failed with exit status 1120

  ----------------------------------------
  Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    Complete output from command c:\users\yshen\desktop\venv\scripts\python.exe
-u -c "import setuptools, tokenize;__file__='C:\\Users\\yshen\\AppData\\Local\\T
emp\\pip-install-c0r_1p_0\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', op
en)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, _
_file__, 'exec'))" install --record C:\Users\yshen\AppData\Local\Temp\pip-record
-bsejxoqc\install-record.txt --single-version-externally-managed --compile --ins
tall-headers c:\users\yshen\desktop\venv\include\site\python3.6\mysqlclient:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    copying _mysql_exceptions.py -> build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\compat.py -> build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\release.py -> build\lib.win-amd64-3.6\MySQLdb
    copying MySQLdb\times.py -> build\lib.win-amd64-3.6\MySQLdb
    creating build\lib.win-amd64-3.6\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.6\MySQLdb\con
stants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.6\MySQLdb\const
ants
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.6\MySQLdb\constants

    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.6\MySQLdb\constants

    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.6\MySQLdb\c
onstants
    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.6\MySQLdb\constan
ts
    copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.6\MySQLdb\cons
tants
    running build_ext
    building '_mysql' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,3,13,'final',0) -D__versio
n__=1.3.13 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\p
ython3.6\include -Ic:\python3.6\include "-IC:\Program Files (x86)\Microsoft Visu
al Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.
0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um
" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program File
s (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1
\include\\winrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.6\Release\_mysql.obj /Zl
    _mysql.c
    _mysql.c(247): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', po
ssible loss of data
    _mysql.c(277): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', po
ssible loss of data
    _mysql.c(418): warning C4244: 'initializing': conversion from 'Py_ssize_t' t
o 'int', possible loss of data
    _mysql.c(753): warning C4244: 'function': conversion from 'SOCKET' to 'long'
, possible loss of data
    _mysql.c(1087): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', p
ossible loss of data
    _mysql.c(1192): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', p
ossible loss of data
    _mysql.c(1404): warning C4267: '=': conversion from 'size_t' to 'int', possi
ble loss of data
    _mysql.c(1406): warning C4267: '=': conversion from 'size_t' to 'int', possi
ble loss of data
    _mysql.c(1403): warning C4996: 'strncpy': This function or variable may be u
nsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(34
6): note: see declaration of 'strncpy'
    _mysql.c(1405): warning C4996: 'strncat': This function or variable may be u
nsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(25
5): note: see declaration of 'strncat'
    _mysql.c(1407): warning C4996: 'strncat': This function or variable may be u
nsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(25
5): note: see declaration of 'strncat'
    _mysql.c(1442): warning C4267: '=': conversion from 'size_t' to 'int', possi
ble loss of data
    _mysql.c(1444): warning C4267: '=': conversion from 'size_t' to 'int', possi
ble loss of data
    _mysql.c(1441): warning C4996: 'strncpy': This function or variable may be u
nsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(34
6): note: see declaration of 'strncpy'
    _mysql.c(1443): warning C4996: 'strncat': This function or variable may be u
nsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(25
5): note: see declaration of 'strncat'
    _mysql.c(1446): warning C4996: 'strncat': This function or variable may be u
nsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(25
5): note: see declaration of 'strncat'
    _mysql.c(2152): warning C4311: 'type cast': pointer truncation from '_mysql_
ConnectionObject *' to 'long'
    _mysql.c(2155): warning C4311: 'type cast': pointer truncation from '_mysql_
ConnectionObject *' to 'long'
    _mysql.c(2150): warning C4996: 'sprintf': This function or variable may be u
nsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(176
9): note: see declaration of 'sprintf'
    _mysql.c(2154): warning C4996: 'sprintf': This function or variable may be u
nsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(176
9): note: see declaration of 'sprintf'
    _mysql.c(2189): warning C4311: 'type cast': pointer truncation from '_mysql_
ResultObject *' to 'long'
    _mysql.c(2189): warning C4996: 'sprintf': This function or variable may be u
nsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE
_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(176
9): note: see declaration of 'sprintf'
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.ex
e /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBP
ATH:C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\vs14" /LIBPATH:c:\pyt
hon3.6\Libs /LIBPATH:c:\users\yshen\desktop\venv\libs /LIBPATH:c:\users\yshen\de
sktop\venv\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studi
o 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.1
0240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\li
b\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64"
kernel32.lib advapi32.lib wsock32.lib mysqlclient.lib /EXPORT:PyInit__mysql buil
d\temp.win-amd64-3.6\Release\_mysql.obj /OUT:build\lib.win-amd64-3.6\_mysql.cp36
-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\_mysql.cp36-win_amd64.li
b /MANIFEST
    _mysql.obj : warning LNK4197: export 'PyInit__mysql' specified multiple time
s; using first specification
       Creating library build\temp.win-amd64-3.6\Release\_mysql.cp36-win_amd64.l
ib and object build\temp.win-amd64-3.6\Release\_mysql.cp36-win_amd64.exp
    _mysql.obj : error LNK2001: unresolved external symbol __security_check_cook
ie
    _mysql.obj : error LNK2001: unresolved external symbol mysql_field_count
    _mysql.obj : error LNK2001: unresolved external symbol mysql_warning_count
    _mysql.obj : error LNK2001: unresolved external symbol mysql_num_rows
    _mysql.obj : error LNK2001: unresolved external symbol mysql_shutdown
    _mysql.obj : error LNK2001: unresolved external symbol mysql_real_query
    _mysql.obj : error LNK2001: unresolved external symbol mysql_ping
    _mysql.obj : error LNK2001: unresolved external symbol mysql_stat
    _mysql.obj : error LNK2001: unresolved external symbol mysql_insert_id
    _mysql.obj : error LNK2001: unresolved external symbol mysql_next_result
    _mysql.obj : error LNK2001: unresolved external symbol mysql_ssl_set
    _mysql.obj : error LNK2001: unresolved external symbol mysql_read_query_resu
lt
    _mysql.obj : error LNK2001: unresolved external symbol mysql_get_proto_info
    _mysql.obj : error LNK2001: unresolved external symbol mysql_more_results
    _mysql.obj : error LNK2001: unresolved external symbol mysql_store_result
    _mysql.obj : error LNK2001: unresolved external symbol mysql_change_user
    _mysql.obj : error LNK2001: unresolved external symbol mysql_get_character_s
et_info
    _mysql.obj : error LNK2001: unresolved external symbol mysql_commit
    _mysql.obj : error LNK2001: unresolved external symbol mysql_get_server_info

    _mysql.obj : error LNK2001: unresolved external symbol mysql_data_seek
    _mysql.obj : error LNK2001: unresolved external symbol mysql_errno
    _mysql.obj : error LNK2001: unresolved external symbol mysql_real_connect
    _mysql.obj : error LNK2001: unresolved external symbol mysql_send_query
    _mysql.obj : error LNK2001: unresolved external symbol mysql_rollback
    _mysql.obj : error LNK2001: unresolved external symbol mysql_options
    _mysql.obj : error LNK2001: unresolved external symbol mysql_real_escape_str
ing_quote
    _mysql.obj : error LNK2001: unresolved external symbol mysql_get_host_info
    _mysql.obj : error LNK2001: unresolved external symbol mysql_fetch_lengths
    _mysql.obj : error LNK2001: unresolved external symbol __imp_strncpy
    _mysql.obj : error LNK2001: unresolved external symbol mysql_affected_rows
    _mysql.obj : error LNK2001: unresolved external symbol mysql_debug
    _mysql.obj : error LNK2001: unresolved external symbol mysql_set_server_opti
on
    _mysql.obj : error LNK2001: unresolved external symbol mysql_set_character_s
et
    _mysql.obj : error LNK2001: unresolved external symbol mysql_dump_debug_info

    _mysql.obj : error LNK2001: unresolved external symbol mysql_close
    _mysql.obj : error LNK2001: unresolved external symbol mysql_server_end
    _mysql.obj : error LNK2001: unresolved external symbol mysql_get_client_info

    _mysql.obj : error LNK2001: unresolved external symbol mysql_server_init
    _mysql.obj : error LNK2001: unresolved external symbol __imp___stdio_common_
vsprintf
    _mysql.obj : error LNK2001: unresolved external symbol mysql_free_result
    _mysql.obj : error LNK2001: unresolved external symbol mysql_fetch_row
    _mysql.obj : error LNK2001: unresolved external symbol mysql_thread_safe
    _mysql.obj : error LNK2001: unresolved external symbol mysql_fetch_fields
    _mysql.obj : error LNK2001: unresolved external symbol mysql_character_set_n
ame
    _mysql.obj : error LNK2001: unresolved external symbol mysql_info
    _mysql.obj : error LNK2001: unresolved external symbol mysql_escape_string
    _mysql.obj : error LNK2001: unresolved external symbol mysql_num_fields
    _mysql.obj : error LNK2001: unresolved external symbol mysql_kill
    _mysql.obj : error LNK2001: unresolved external symbol __imp_strncat
    _mysql.obj : error LNK2001: unresolved external symbol mysql_use_result
    _mysql.obj : error LNK2001: unresolved external symbol mysql_select_db
    _mysql.obj : error LNK2001: unresolved external symbol mysql_sqlstate
    _mysql.obj : error LNK2001: unresolved external symbol mysql_init
    _mysql.obj : error LNK2001: unresolved external symbol mysql_autocommit
    _mysql.obj : error LNK2001: unresolved external symbol mysql_error
    _mysql.obj : error LNK2001: unresolved external symbol mysql_thread_id
    LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
    build\lib.win-amd64-3.6\_mysql.cp36-win_amd64.pyd : fatal error LNK1120: 57
unresolved externals
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\B
IN\\x86_amd64\\link.exe' failed with exit status 1120

    ----------------------------------------
Command "c:\users\yshen\desktop\venv\scripts\python.exe -u -c "import setuptools
, tokenize;__file__='C:\\Users\\yshen\\AppData\\Local\\Temp\\pip-install-c0r_1p_
0\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.rea
d().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" insta
ll --record C:\Users\yshen\AppData\Local\Temp\pip-record-bsejxoqc\install-record
.txt --single-version-externally-managed --compile --install-headers c:\users\ys
hen\desktop\venv\include\site\python3.6\mysqlclient" failed with error code 1 in
 C:\Users\yshen\AppData\Local\Temp\pip-install-c0r_1p_0\mysqlclient\

0 个答案:

没有答案