I installed python latest version python3.10.0 and django version 3.2.8. I tried to install mysqlclient by using pip install mysqlclientcommand in the command prompt but it shows an error like below:

 Building wheel for mysqlclient (setup.py) ... errorERROR: Command errored out with exit status 1:command: 'F:\django\job\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\IIITK2\\AppData\\Local\\Temp\\pip-install-ja9ipfah\\mysqlclient_08057cd8bc0f44f5bca353c6775cb063\\setup.py'"'"'; __file__='"'"'C:\\Users\\IIITK2\\AppData\\Local\\Temp\\pip-install-ja9ipfah\\mysqlclient_08057cd8bc0f44f5bca353c6775cb063\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\IIITK2\AppData\Local\Temp\pip-wheel-p39kz555'cwd: C:\Users\IIITK2\AppData\Local\Temp\pip-install-ja9ipfah\mysqlclient_08057cd8bc0f44f5bca353c6775cb063\Complete output (23 lines):running bdist_wheelrunning buildrunning build_pycreating buildcreating build\lib.win-amd64-3.10creating build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\__init__.py -> build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\_exceptions.py -> build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\connections.py -> build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\converters.py -> build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\cursors.py -> build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\release.py -> build\lib.win-amd64-3.10\MySQLdbcopying MySQLdb\times.py -> build\lib.win-amd64-3.10\MySQLdbcreating build\lib.win-amd64-3.10\MySQLdb\constantscopying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.10\MySQLdb\constantscopying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.10\MySQLdb\constantscopying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.10\MySQLdb\constantscopying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.10\MySQLdb\constantscopying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.10\MySQLdb\constantscopying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.10\MySQLdb\constantsrunning build_extbuilding 'MySQLdb._mysql' extensionerror: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Can anyone say a solution for this?

4

Best Answer


Now available mysqlclient 2.1.0.mysqlclient 2.0.3 not support python 3.10 version.

Run this command now pip install mysqlclient

Following oficial instructions, for Ubuntu run:

sudo apt-get install python3-dev default-libmysqlclient-dev build-essential

Ubuntu needs this OS package for the python package mysqlclient to install:

sudo apt install libmysqlclient-dev

people using python 3.10 version can use this link < https://www.wheelodex.org/projects/mysqlclient/wheels/mysqlclient-2.1.1-cp310-cp310-win_amd64.whl/ >

to download wheel or it will give error.!open the img to know which link you have to cick