无法打开inlude mysql.h,使用Python 3.6.5安装MySQLdb的问题:无法打开'mysql.h'-无法打开:'config-win.h':没有此类文件或目录...

I am trying to use mysql with python SQLAlchemy however python fails to install MySQL or even recognize it is installed. Below are the details:

I'm running this on Windows 10 64 bit and Anaconda Python 3.6.5

I downloaded MySQL through MAMP: Mac-Apace-MySQL-PHP

https://www.mamp.info/en/

I have tried running my code on VSC and Jupyter.

If I try running the code pip install mysqlclient

_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 tried pip install MySQL-python but get

_mysql.c

_mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.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 tried pip install MySQLdb and get:

Collecting MySQLdb

Could not find a version that satisfies the requirement

MySQLdb (from versions: )

No matching distribution found for MySQLdb

I tried installing MySQL - from the actual Oracle website, did not work

I tried downloading the MySQL-connector to python: I get

python v3.6 not found. we only support python using MSI.

I heave searched this issue on SoF but every issue is either outdated or custom geared towards that poster's case and I honestly would not know where to start. I've read that it may be a config issue to where python can't tell where MySQL is located and so I need to customize the path to it but I do not have the technical depth to meddle with that as I'm worried I may end up making it even worst.

I sincerely appreciate any input to this matter as I am truly in a bind and have no idea where to go from here.

解决方案

Use the precompiled binary whl file from Cristoph Golke. It's far easier than setting up the complete dev environment to compile a single library.

Download the .whl file, then pip install inside the python environment you're using.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值