Search code examples
pythonmysqlpipmysql-pythonpython-wheel

Can't install mysqlclient on Windows64


I am using windows10 64bit, python 3.8.2 and unable to install mysqlclient/mysql via pip3, it asked me to download Microsoft Visual C++ 14.00 something, which I did but got a new error after. I did some research and tried manually download the .whl file and still unable to install. Because I need to import MySQLdb I tried pip3 install mysql-python or install mysqlclient didn't end up well.

  _mysql.c
  _mysql.c(42): fatal error C1083: Unable to open: “config-win.h”: No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

When I manually install .whl file, I get this error

$ pip3 install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
ERROR: mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.

Although I can install mysql.connector since I am using import mysql.connector in my other projects, I have no idea why I can't install MySQL or mysqlclient, I know there are similar questions to mine, but I didn't find a solution from other posts.


Solution

  • ERROR: mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

    You have 32-bit Python. With it you cannot install 64-bit wheel (amd64.whl). Download 32-bit wheel.

    Or replace your Python with 64-bit Python and reinstall all packages.