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.