gpt4 book ai didi

django - 使用pip(python)安装mysql时出错

转载 作者:行者123 更新时间:2023-12-02 03:08:18 25 4
gpt4 key购买 nike

我是 python 新手,最近开始了解Django,对于一些基本的功能,我必须使用 pip,当我尝试使用 pip 安装一些包时,它会给出错误 live Belove。感谢您的友好回应。

C:\Users\Artoon>pip install mysql
Collecting mysql
Collecting MySQL-python (from mysql)
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... error
Complete output from command c:\paython36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Artoon\\AppData\\Local\\Temp\\pip-build-la79b8wq\\MySQL-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Artoon\AppData\Local\Temp\tmpg_5j7u4fpip-wheel- --python-tag cp36:
running bdist_wheel
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\converters.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\connections.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\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.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\FLAG.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.6\MySQLdb\constants
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,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\paython36\include -Ic:\paython36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (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
C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\config-win.h(192): warning C4005: 'isnan': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\math.h(264): note: see previous definition of 'isnan'
C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\config-win.h(203): warning C4005: 'SIZEOF_OFF_T': macro redefinition
c:\paython36\include\pyconfig.h(332): note: 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:\paython36\include\pyconfig.h(675): note: 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(297): warning C4090: '=': different 'const' qualifiers
_mysql.c(317): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(327): warning C4090: '=': different 'const' qualifiers
_mysql.c(470): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(623): warning C4090: '=': different 'const' qualifiers
_mysql.c(624): warning C4090: '=': different 'const' qualifiers
_mysql.c(625): warning C4090: '=': different 'const' qualifiers
_mysql.c(626): warning C4090: '=': different 'const' qualifiers
_mysql.c(627): warning C4090: '=': different 'const' qualifiers
_mysql.c(1118): warning C4090: '=': different 'const' qualifiers
_mysql.c(1161): warning C4090: '=': different 'const' qualifiers
_mysql.c(1162): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1165): warning C4090: '=': different 'const' qualifiers
_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(2238): warning C4311: 'type cast': pointer truncation from '_mysql_ConnectionObject *' to 'long'
_mysql.c(2241): warning C4311: 'type cast': pointer truncation from '_mysql_ConnectionObject *' to 'long'
_mysql.c(2302): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
_mysql.c(2321): warning C4311: 'type cast': pointer truncation from '_mysql_ResultObject *' to 'long'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt" /LIBPATH:c:\paython36\libs /LIBPATH:c:\paython36\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\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 build\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.lib
_mysql.obj : warning LNK4197: export 'PyInit__mysql' specified multiple times; 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
mysqlclient.lib(typelib.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(viosslfactories.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_winfile.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_messnc.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(client.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_thr_init.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_init.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(default.obj) : error LNK2001: unresolved external symbol __iob_func
build\lib.win-amd64-3.6\_mysql.cp36-win_amd64.pyd : fatal error LNK1120: 1 unresolved 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 MySQL-python
Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python, mysql
Running setup.py install for MySQL-python ... error
Complete output from command c:\paython36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Artoon\\AppData\\Local\\Temp\\pip-build-la79b8wq\\MySQL-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Artoon\AppData\Local\Temp\pip-a7xacs6e-record\install-record.txt --single-version-externally-managed --compile:
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\converters.py -> build\lib.win-amd64-3.6\MySQLdb
copying MySQLdb\connections.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\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.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\FLAG.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.6\MySQLdb\constants
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,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\paython36\include -Ic:\paython36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (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
C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\config-win.h(192): warning C4005: 'isnan': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\math.h(264): note: see previous definition of 'isnan'
C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\config-win.h(203): warning C4005: 'SIZEOF_OFF_T': macro redefinition
c:\paython36\include\pyconfig.h(332): note: 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:\paython36\include\pyconfig.h(675): note: 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(297): warning C4090: '=': different 'const' qualifiers
_mysql.c(317): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(327): warning C4090: '=': different 'const' qualifiers
_mysql.c(470): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(623): warning C4090: '=': different 'const' qualifiers
_mysql.c(624): warning C4090: '=': different 'const' qualifiers
_mysql.c(625): warning C4090: '=': different 'const' qualifiers
_mysql.c(626): warning C4090: '=': different 'const' qualifiers
_mysql.c(627): warning C4090: '=': different 'const' qualifiers
_mysql.c(1118): warning C4090: '=': different 'const' qualifiers
_mysql.c(1161): warning C4090: '=': different 'const' qualifiers
_mysql.c(1162): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1165): warning C4090: '=': different 'const' qualifiers
_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(2238): warning C4311: 'type cast': pointer truncation from '_mysql_ConnectionObject *' to 'long'
_mysql.c(2241): warning C4311: 'type cast': pointer truncation from '_mysql_ConnectionObject *' to 'long'
_mysql.c(2302): warning C4244: 'function': conversion from '__int64' to 'long', possible loss of data
_mysql.c(2321): warning C4311: 'type cast': pointer truncation from '_mysql_ResultObject *' to 'long'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt" /LIBPATH:c:\paython36\libs /LIBPATH:c:\paython36\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\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 build\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.lib
_mysql.obj : warning LNK4197: export 'PyInit__mysql' specified multiple times; 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
mysqlclient.lib(typelib.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(viosslfactories.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_winfile.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_messnc.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(client.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_thr_init.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(my_init.obj) : error LNK2001: unresolved external symbol __iob_func
mysqlclient.lib(default.obj) : error LNK2001: unresolved external symbol __iob_func
build\lib.win-amd64-3.6\_mysql.cp36-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120

----------------------------------------
Command "c:\paython36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Artoon\\AppData\\Local\\Temp\\pip-build-la79b8wq\\MySQL-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Artoon\AppData\Local\Temp\pip-a7xacs6e-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Artoon\AppData\Local\Temp\pip-build-la79b8wq\MySQL-python\

最佳答案

我明白了,删除所有版本的python,并安装 2.7,pip,然后下载

**

MySQL_python-1.2.5-cp27-none-win32.whl

**

来自 http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

然后运行命令 As Belove

pip install MySQL_python-1.2.5-cp27-none-win32.whl

关于django - 使用pip(python)安装mysql时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41283988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com