0

I'm currently working through a Django tutorial and after trying to install mysqlclient I have had the following error message on my CMD.

Many thanks in advance

Failed building wheel for mysqlclient

Running setup.py clean for mysqlclient

Failed to build mysqlclient

Installing collected packages: mysqlclient

Running setup.py install for mysqlclient ... error

 Complete output from command c:\users\o\envs\py1\scripts\python.exe -u
-c "import setuptools, 
 tokenize;__file__='C:\\Users\\O\\AppData\\Local\\T
 emp\\pip-install-kej8gk5_\\mysqlclient\\setup.py';f=getattr(tokenize, 
'open', op
 en)(__file__);code=f.read().replace('\r\n', 
  '\n');f.close();exec(compile(code, _
   _file__, 'exec'))" install --record 
  C:\Users\O\AppData\Local\Temp\pip-reco
  rd-_27hw8hl\install-record.txt --single-version-externally-managed -- 
 compile --install-headers 
  c:\users\o\envs\py1\include\site\python3.7\mysqlclient:
running install

running build

running build_py

creating build

creating build\lib.win32-3.7

copying _mysql_exceptions.py -> build\lib.win32-3.7

creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32- 
 3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32- 
 3.7\MySQLdb\constants

copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32- 
 3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32 3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
Mr Mann
  • 35
  • 6
  • Could you elaborate what you have tried to fix the `Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools"` message? – FlyingTeller Aug 14 '18 at 11:46
  • I have tried to download Visual C++ but the link, has an error also: http://landinghub.visualstudio.com/visual-cpp-build-tools – Mr Mann Aug 14 '18 at 12:02
  • The link is broken. Try [this one from the python wiki](https://wiki.python.org/moin/WindowsCompilers) or [the Visual Studio download page](https://visualstudio.microsoft.com/downloads/) – FlyingTeller Aug 14 '18 at 12:04
  • Also try updating your isntallation of `setuptools`: `pip install --upgrade setuptools` to get rid of the broken link – FlyingTeller Aug 14 '18 at 12:07
  • Thanks for the link, I have downloaded the community version, Should I do the upgrade setup tools after I have downloaded the MS Visual C++? – Mr Mann Aug 14 '18 at 13:12
  • You should start with the `setuptools` upgrade as laid out on the [python wiki page](https://wiki.python.org/moin/WindowsCompilers) I have linked before: " Before do anything, install or upgrade the Setuptools Python package. It contain compatibility improvements and add automatic use of compilers" – FlyingTeller Aug 14 '18 at 13:14
  • Possible duplicate of [Installing mysqlclient in Python 3.6 in windows](https://stackoverflow.com/questions/51146117/installing-mysqlclient-in-python-3-6-in-windows) – phd Aug 14 '18 at 20:59
  • Many thanks - FlyingTeller ans phd – Mr Mann Dec 02 '18 at 15:54

1 Answers1

1

i will recommend use python 64-bit.

This problem occured when mysql is of 64-bit and python is of 32-bit and when we forcefully install mysqlclient via this websitePython Extension Package Or you can install both of 32-bit pip install mysqlclient or use this:pip install --only-binary :all: mysqlclient Using 64-bit python you can easily install it.