python - 无法安装mysqlclient连接mysql
问题描述
安装 mysqlclient 时出现以下错误。我使用 pycharm 和 python 3.6
(venv) C:\Users\gselvaraj\PycharmProjects\djano_tutorial>pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command C:\Users\gselvaraj\PycharmProjects\djano_tutorial\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GSELVA~1\\AppData\\Local\\Temp\\pip-install-4v4c77rd\\mysqlclient\\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\GSELVA~1\AppData\Local\Temp\pip-record-5yo0ns17\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\g
selvaraj\PycharmProjects\djano_tutorial\venv\include\site\python3.6\mysqlclient:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
creating build\lib.win32-3.6\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.6\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.6\MySQLdb
creating build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.6\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.6\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
creating build\temp.win32-3.6\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\m
ariadb" -IC:\Users\gselvaraj\PycharmProjects\djano_tutorial\venv\include -IC:\Users\gselvaraj\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\gselvaraj\AppData\Local\Programs\Python\Python36-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\201
9\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.6\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Command "C:\Users\gselvaraj\PycharmProjects\djano_tutorial\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GSELVA~1\\AppData\\Local\\Temp\\pip-install-4v4c77rd\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.r
ead().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\GSELVA~1\AppData\Local\Temp\pip-record-5yo0ns17\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\gselvaraj\PycharmProjects
\djano_tutorial\venv\include\site\python3.6\mysqlclient" failed with error code 1 in C:\Users\GSELVA~1\AppData\Local\Temp\pip-install-4v4c77rd\mysqlclient\
(venv) C:\Users\gselvaraj\PycharmProjects\djano_tutorial>>
The syntax of the command is incorrect.
(venv) C:\Users\gselvaraj\PycharmProjects\djano_tutorial>
(venv) C:\Users\gselvaraj\PycharmProjects\djano_tutorial>>
The syntax of the command is incorrect.
(venv) C:\Users\gselvaraj\PycharmProjects\djano_tutorial>wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
'wget' is not recognized as an internal or external command,
operable program or batch file.
解决方案
推荐阅读
- vue.js - 如何从 registerServiceWorker.js 调用 Vue app $refs.components 或 Vuex $store 中的方法?
- typescript - 打字稿:如何从导入的命名空间存根函数
- angular - 无法显示列表项
- javascript - 如何绕过 Safari 中的弹出窗口拦截器
- php - 我希望您将新信息(以 JSON 格式)异步发送到 PHP 页面。PHP接收新数据并更新数据库
- php - 如果正确,则使用 PHP 语法 if/else
- ios - 将营销版本和构建版本从主应用程序复制到 Xcode 11 上的扩展程序
- clojure - 如何从 Reitit 后端路由中提取路径参数
- c# - XslCompiledTransform 忽略 .NET Framework 4.6 及更高版本上的 DTD 架构
- python - 如何将三个 Conllu 文件与 Conllu python 库合并?