0

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) ... error
  ERROR: 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-p39k
z555'
   cwd: C:\Users\IIITK2\AppData\Local\Temp\pip-install-ja9ipfah\mysqlclient_08057cd8bc0f44f5bca353c6775cb063\
  Complete output (23 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\__init__.py -> build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\_exceptions.py -> build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\connections.py -> build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\converters.py -> build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\cursors.py -> build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\release.py -> build\lib.win-amd64-3.10\MySQLdb
  copying MySQLdb\times.py -> build\lib.win-amd64-3.10\MySQLdb
  creating build\lib.win-amd64-3.10\MySQLdb\constants
  copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.10\MySQLdb\constants
  copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.10\MySQLdb\constants
  copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.10\MySQLdb\constants
  copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.10\MySQLdb\constants
  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.10\MySQLdb\constants
  copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.10\MySQLdb\constants
  running build_ext
  building 'MySQLdb._mysql' extension
  error: 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?

Abin Benny
  • 125
  • 2
  • 10

4 Answers4

1

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

Run this command now pip install mysqlclient

1

Following oficial instructions, for Ubuntu run:

sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
jobima
  • 5,790
  • 1
  • 20
  • 18
0

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

sudo apt install libmysqlclient-dev
tread
  • 10,133
  • 17
  • 95
  • 170
0

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

  • 1
    Why use that dodgy-looking site instead of PyPI which is the original source of it, and the known, trusted way of distributing Python modules? – DavidW Jul 22 '22 at 11:37
  • https://pypi.org/project/mysqlclient/#files - The link goes to https://files.pythonhosted.org/packages/9c/4b/ea487008d89731bcb80df55be2ed89c18dce927fd033ec4353d408d789ef/mysqlclient-2.1.1-cp310-cp310-win_amd64.whl. In fairness wheelodex does look like a reputable project but it seems odd not just to use PyPI – DavidW Jul 25 '22 at 12:25