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
  • 71
  • 8

3 Answers3

1

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

Run this command now pip install mysqlclient

0

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

sudo apt install libmysqlclient-dev
tread
  • 9,064
  • 16
  • 86
  • 149
0

Following oficial instructions, for Ubuntu run:

sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
jobima
  • 5,662
  • 1
  • 19
  • 18