Troubleshooting MySQL-Python Installation Error on Windows: Cannot Open Include File
When attempting to install the mysql-python connector, you may encounter the error "Cannot open include file: 'config-win.h'." This issue is particularly prevalent on Windows systems.
The cause of this error typically lies in missing or outdated Visual C components. To resolve this issue, verify that you have installed the latest version of Visual Studio C redistributable for your system. Ensure that you select both the 32-bit and 64-bit versions, even if your operating system is 64-bit.
Alternative Installation Method for 64-bit Windows
If the aforementioned steps do not resolve the issue, consider using the wheel installation method for 64-bit Windows machines:
Install Wheel: Run the following command in your terminal:
pip install wheel
For Python 3.x:
pip install mysqlclient-1.3.8-cp36-cp36m-win_amd64.whl
For Python 2.7:
pip install mysqlclient-1.3.8-cp27-cp27m-win_amd64.whl
The above is the detailed content of Why Can't I Install mysql-python on Windows?. For more information, please follow other related articles on the PHP Chinese website!