Python pip install mysqlclient 返回“致命错误 C1083:无法打开文件:'mysql.h':没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51294268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pip install mysqlclient returns "fatal error C1083: Cannot open file: 'mysql.h': No such file or directory
提问by Aaron McCommon
Here is this issue: I attempt to install mysqlclient like so
这是这个问题:我尝试像这样安装 mysqlclient
C:\Users\amccommon349>pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1
cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command c:\users\amccommon349\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\AMCCOM~1\AppData\Local\Temp\pip-install-qcgo48hf\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\AMCCOM~1\AppData\Local\Temp\pip-record-q4yoftj8\install-record.txt --single-version-externally-managed --compile:
c:\users\amccommon349\appdata\local\programs\python\python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
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\constants
copying MySQLdb\constants\CLIENT.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\ER.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\FLAG.py -> build\lib.win-amd64-3.6\MySQLdb\constants
copying MySQLdb\constants\REFRESH.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 Studio17\BuildTools\VC\Tools\MSVC.14.26428\bin\HostX86\x64\cl.exe /c/nologo/Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\users\amccommon349\appdata\local\programs\python\python36\include -Ic:\users\amccommon349\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio17\BuildTools\VC\Tools\MSVC.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17134.0\um" "-IC:\ProgramFiles (x86)\Windows Kits\include.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17134.0\cppwinrt" /Tc_mysql.c /Fobuild\temp.win-amd64-3.6\Release\_mysql.obj /Zl _mysql.c
_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\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2
I made sure I had all of the files needed from visual studios build tools, I downloaded the mysql-python connector, and updated my pip and setup tools. I am a complete beginner to this and would appreciate any input as to how to go about fixing this error.
我确保我拥有 Visual Studios 构建工具所需的所有文件,我下载了 mysql-python 连接器,并更新了我的 pip 和设置工具。我是一个完整的初学者,并会感谢任何有关如何解决此错误的意见。
回答by Nipun Sampath
You can download unofficial windows binaries for your python version using https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. Then install it using pip. This way you'll be able to avoid the hassle of dealing with visual studio build tools.
您可以使用https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient下载适用于您的 Python 版本的非官方 Windows 二进制文件。然后使用pip安装它。通过这种方式,您将能够避免处理 Visual Studio 构建工具的麻烦。
Just download the mysqlclient.whl file most applicable to you. I think in your case it'll be
只需下载最适合您的 mysqlclient.whl 文件。我认为在你的情况下会
mysqlclient?1.3.13?cp36?cp36m?win_amd64.whl
mysqlclient?1.3.13?cp36?cp36m?win_amd64.whl
and run
并运行
pip install "path to the downloaded .whl file"
回答by Σωτ?ρη? Τσακιρ?δη?
This error occurs when trying to install mysqlclient for python32 in 64 bit environments. Uninstall python and re-install 64 bit version. Then pip install mysqlclient will run with no errors.
尝试在 64 位环境中为 python32 安装 mysqlclient 时出现此错误。卸载python并重新安装64位版本。然后 pip install mysqlclient 将没有错误地运行。
回答by John
Well probably,this is one of the stupidest errors i have ever witnessed.
I have Python 3.7.3 32bit along with latest pip3 and i was installing wheels to my Python....and i stumbled on this STUPID error....
Probably my situation is a bit different but you can resolve it just by looking carefully at the error.... at first it seems something is missing and you start blaming you, Windows ,32/64bit and the list goes on and on..
Take a step back...just take a step back and just read the nasty red error message.... read it really well.
In my case it was
很可能,这是我见过的最愚蠢的错误之一。
我有 Python 3.7.3 32bit 和最新的 pip3 并且我正在为我的 Python 安装轮子......我偶然发现了这个 STUPID 错误......
可能我的情况有点不同,但你可以通过仔细查看来解决它在错误处.... 起初似乎缺少某些东西,您开始责怪您,Windows 32/64 位,并且该列表还在继续
...退后一步...只需退后一步,只需阅读讨厌的红色错误信息.... 读得真好。
就我而言,它是
ERROR: Command errored out with exit status 1:
command: 'c:\users\myUserName\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\MASTER~1\AppData\Local\Temp\pip-install-z7x81g2q\mysqlclient\setup.py'"'"'; __file__='"'"'C:\Users\MASTER~1\AppData\Local\Temp\pip-install-z7x81g2q\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\MASTER~1\AppData\Local\Temp\pip-record-z1mvci5v\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\MASTER~1\AppData\Local\Temp\pip-install-z7x81g2q\mysqlclient\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.21.27702\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -Ic:\users\MyUserName\appdata\local\programs\python\python37-32\include -Ic:\users\MyUserName\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.21.27702\include" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\cppwinrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.7\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.21.27702\bin\HostX86\x86\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\MyUserName\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\MASTER~1\AppData\Local\Temp\pip-install-z7x81g2q\mysqlclient\setup.py'"'"'; __file__='"'"'C:\Users\MASTER~1\AppData\Local\Temp\pip-install-z7x81g2q\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\MASTER~1\AppData\Local\Temp\pip-record-z1mvci5v\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Have you read it well ?...i assume that you have everything ... the Build tools, the MySQL Connector C 6.1...you even moved it to Program Files (x86)...so what it wrong...?? ...
Now take a closer look
你读得好吗?......我假设你拥有一切......构建工具,MySQL连接器C 6.1......你甚至将它移到了Program Files(x86)......那有什么错...... ?? ......
现在仔细看看
C:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.21.27702\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -
I am pretty sure you saw it...STILL NO ?.... let me bold it for you
我很确定你看到了它......还是没有?......让我为你加粗
"-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -
mariadb
Well it can't be any stupidest than this ...the installer looks for mariadb includesand later libsJust go to the mariadb site and download the MariaDB C/C++ connector and install it...
Well its not over..
Goto to C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include
and create folder mariadb...and copy paste the contents from the mariaDb connector installation includefolder
againdon't go way...go to
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib and do again the same drill for the libfolder
so you should have
mariadb
没有比这更愚蠢的了...安装程序会查找 mariadb包含的内容和更高版本的库只需转到 mariadb 站点并下载 MariaDB C/C++ 连接器并安装它...
还没有结束...转到到C:\ Program Files文件(x86)的\ MySQL的\ MySQL的插头C 6.1 \ include和创建文件夹,MariaDB的...和复制粘贴从MariaDB的连接器安装的内容包括文件夹,
再不去办法......去C: \Program Files (x86)\MySQL\MySQL Connector C 6.1\lib 并再次对lib文件夹进行相同的练习,
所以你应该有
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\mariadb
Now hit the pip3 install mysqlclient
and enjoy installing without a nag...the end
现在点击pip3 install mysqlclient
并享受没有唠叨的安装......结束
Successfully installed mysqlclient-1.4.2.post1
回答by Code_Worm
I had this issue (exactly same error) and tried all the solutions mentioned above, and neither of them worked (at least for me), actually I was about to pull my hairs over this issue till I found the solution in a very weird, simple and stupid way!! .
我遇到了这个问题(完全相同的错误)并尝试了上面提到的所有解决方案,但它们都不起作用(至少对我而言),实际上我正准备解决这个问题,直到我找到了一个非常奇怪的解决方案,简单而愚蠢的方式!!.
I did the following steps so that the problem solved and life got sweet again.
我做了以下步骤,使问题得到解决,生活再次变得甜蜜。
First I installed MySQL Connector/C
from here
首先我MySQL Connector/C
从这里安装
Second (after installation finished) I copied MySQL Connector C 6.1
folder fromProgram files/MySQL
into Program files (x86)/MySQL
二(安装结束后)我复制MySQL Connector C 6.1
文件夹从Program files/MySQL
成Program files (x86)/MySQL
note that you might have to create MySQL
folder if it doesn't exist in Program files (x86)
(it didn't exist for me)
请注意,MySQL
如果文件夹不存在Program files (x86)
(对我来说不存在),则可能需要创建文件夹
As simple as that, it worked for me, it seems for some (or all) 64-bit windows, pip or more probably mysqlclient
setup script only searches Program files (x86)
folder for some MySQL files (such as 'mysql.h') and doesn't search Program files
and since doesn't find anything in Program files (x86)
raises the error very dumb!!! isn't it
就这么简单,它对我有用,似乎适用于某些(或全部)64 位 Windows、pip 或更可能的mysqlclient
安装脚本只搜索Program files (x86)
文件夹中的某些 MySQL 文件(例如“mysql.h”)而不搜索Program files
并且因为没有找到任何东西Program files (x86)
引发了非常愚蠢的错误!!!是不是
回答by Ralph Ritoch
This is a problem with the 64 bit version of python on Windows 10. The following repaired the problem for me.
这是windows 10上64位版本python的问题,下面为我修复了这个问题。
- Install the 32 bit version of python for windows (currently version 3.7.1)
- Install visual studio build tools https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017for C++
- Install the 32 bit mysql connector version 6.1.11 from https://downloads.mysql.com/archives/c-c/
- 为 windows 安装 32 位版本的 python(当前版本为 3.7.1)
- 为 C++安装 Visual Studio 构建工具 https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017
- 从https://downloads.mysql.com/archives/cc/安装 32 位 mysql 连接器版本 6.1.11
After this I was able to install mysqlclient with pip install mysqlclient
.
在此之后,我能够使用pip install mysqlclient
.
Hopefully someone will come up with a better solution that doesn't require downgrading to 32 bit because this is not a good solution, it just works. I found a way to work around the mysql issue but ran into the problem again while trying to install channels. It seems python 64 bit is looking for 32 bit libraries instead of 64 bit libraries on windows. So far this solution has solved all of my python build problems on windows.
希望有人会提出一个更好的解决方案,不需要降级到 32 位,因为这不是一个好的解决方案,它只是有效。我找到了解决 mysql 问题的方法,但在尝试安装频道时再次遇到问题。似乎python 64位正在寻找32位库而不是Windows上的64位库。到目前为止,这个解决方案已经解决了我在 Windows 上的所有 python 构建问题。
回答by Erfan
None of the solutions above worked for me. Apparently I had to downgrade my Python from 3.7.x
to 3.6.4
and that solved the problem for me. Downloadlinkfor python=3.6.4
.
上述解决方案都不适合我。显然,我不得不降级我的Python3.7.x
来3.6.4
,并且解决了这个问题对我来说。Downloadlink的python=3.6.4
。
I would recommend to create a new virtual environment for this and not to uninstall your main python. Find extensive documentation on how to create a venv
here.
我建议为此创建一个新的虚拟环境,而不是卸载您的主 python。在venv
此处查找有关如何创建的大量文档。
回答by Razvi
This is what solved my issue
这就是解决我的问题的原因
- Install MySQL Connector/C (Archived Versions) from here
- 从这里安装 MySQL Connector/C (Archived Versions)
It is probably installed in the following location
C:\Program Files\MySQL\MySQL Connector C 6.1
它可能安装在以下位置
C:\Program Files\MySQL\MySQL Connector C 6.1
- Copy the entire folder
MySQL Connector C 6.1
toC:\Program Files (x86)\MySQL\MySQL Connector C 6.1
- 将整个文件夹复制
MySQL Connector C 6.1
到C:\Program Files (x86)\MySQL\MySQL Connector C 6.1
- Try executing the command
pip3 install mysqlclient
.
- 尝试执行命令
pip3 install mysqlclient
。
Successful. Good Job!
成功的。做得好!
Unsuccessful?
不成功?
- Install MariaDB connector from here
- 从这里安装 MariaDB 连接器
Probably installed in the location
可能安装在该位置
C:\Program Files\MariaDB\MariaDB Connector C 64-bit
- Copy the contents from
- 复制内容从
C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include
C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include
and Paste into a folder name it as mariadb
and paste it to the location
并粘贴到文件夹中,将其命名为mariadb
并将其粘贴到该位置
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\
Copy the contents from
C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib
复制内容从
C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib
and Paste into a folder name it as mariadb
and paste it to the location
并粘贴到文件夹中,将其命名为mariadb
并将其粘贴到该位置
`C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib`
- Try executing the command
pip3 install mysqlclient
.
- 尝试执行命令
pip3 install mysqlclient
。
This worked for me
这对我有用
回答by nerd01
Thanks for all the answers, but it was not sufficient to solve my problem. However it put me on the right path :). To solve the error of the missing sys/types.h I had to copy this types.h file from "c:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\sys\" to "c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb\sys\". Then I could finally install mysqlclient.
感谢所有的答案,但这还不足以解决我的问题。然而,它让我走上了正确的道路:)。为了解决缺少 sys/types.h 的错误,我不得不将这个 types.h 文件从“c:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\sys\”复制到“ c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb\sys\"。然后我终于可以安装mysqlclient了。
回答by mrivas
for me, pip install mysqlclient
was throwing error...
对我来说,pip install mysqlclient
正在抛出错误......
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\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86\cl.exe' failed with exit status 2
It seems mysqlclient is 64 bit. So I Forced both Python and pip to execute from the 64 bit directory.
mysqlclient 似乎是 64 位的。所以我强制 Python 和 pip 从 64 位目录执行。
Explicitly...
明确...
don't run python -m venv myvemv and pip install -r requirements.txt
,
不要run python -m venv myvemv and pip install -r requirements.txt
,
run the following...
运行以下...
C:\Users\mr\AppData\Local\Programs\Python\Python37\python -m venv [path to your virtual env goes here]
and
和
C:\Users\mr\AppData\Local\Programs\Python\Python37\Scripts\pip install -r requirements.txt
回答by gnumaru
I wanted to comment on John's answer but my comment was too long so I had to make another answer. Sorry for that.
我想对约翰的回答发表评论,但我的评论太长了,所以我不得不再做一个回答。对不起。
John, this helped me a lot, thanks. Not properly reading the logs is a bad habit for many people, myself included.
约翰,这对我帮助很大,谢谢。不正确阅读日志对许多人来说是一个坏习惯,包括我自己。
But instead of downloading the mariadb connector (or searching the net for a prebuilt wheel), I managed to do it with oracle's mysql connector. And I prefer to do symbolic links instead of copying files. Here's what I did using windows 10 x64, python 3.8 x64 and oracle's mysql connector x64:
但是我没有下载 mariadb 连接器(或在网上搜索预建的轮子),而是设法使用 oracle 的 mysql 连接器来完成。而且我更喜欢做符号链接而不是复制文件。这是我使用 windows 10 x64、python 3.8 x64 和 oracle 的 mysql 连接器 x64 所做的:
# run this on an elevated command prompt if your user does not have permission to make symbolic links
# download and install https://downloads.mysql.com/archives/c-c/
mklink /d "C:\Program Files\MySQL\MySQL Connector C 6.1\include\mariadb" "C:\Program Files\MySQL\MySQL Connector C 6.1\include\mysql"
mklink /d "C:\Program Files (x86)\MySQL" "C:\Program Files\MySQL"
mklink /d "C:\Program Files\MySQL\MySQL Connector C 6.1\lib\mariadb" "C:\Program Files\MySQL\MySQL Connector C 6.1\lib\vs14"
mklink "C:\Program Files\MySQL\MySQL Connector C 6.1\lib\vs14\mariadbclient.lib" "C:\Program Files\MySQL\MySQL Connector C 6.1\lib\vs14\mysqlclient.lib"
SET INCLUDE=C:\Program Files\MySQL\MySQL Connector C 6.1\include;%INCLUDE%
python3 -m pip install mysqlclient
And that's it.
就是这样。