Skip to content
Advertisement

pip install mysqlclient : Microsoft Visual C++ 14.0 is required

i’m tryng to import mysqlclient library for python with pip, when i use the command
pip install mysqlclient it return an error:

Collecting mysqlclient
Using cached     https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command c:usersastrinaappdatalocalprogramspythonpython36python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\astrina\AppData\Local\Temp\pip-install-40l_x_f4\mysqlclient\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersastrinaAppDataLocalTemppip-record-va173t5vinstall-record.txt --single-version-externally-managed --compile:
c:usersastrinaappdatalocalprogramspythonpython36libdistutilsdist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running install
running build
running build_py
creating build
creating buildlib.win-amd64-3.6
copying _mysql_exceptions.py -> buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6MySQLdb
copying MySQLdb__init__.py -> buildlib.win-amd64-3.6MySQLdb
copying MySQLdbcompat.py -> buildlib.win-amd64-3.6MySQLdb
copying MySQLdbconnections.py -> buildlib.win-amd64-3.6MySQLdb
copying MySQLdbconverters.py -> buildlib.win-amd64-3.6MySQLdb
copying MySQLdbcursors.py -> buildlib.win-amd64-3.6MySQLdb
copying MySQLdbrelease.py -> buildlib.win-amd64-3.6MySQLdb
copying MySQLdbtimes.py -> buildlib.win-amd64-3.6MySQLdb
creating buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.6MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win-amd64-3.6MySQLdbconstants
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

----------------------------------------
Command "c:usersastrinaappdatalocalprogramspythonpython36python.exe -u -c "import setuptools, 
tokenize;__file__='C:\Users\astrina\AppData\Local\Temp\pip-install- 
40l_x_f4\mysqlclient\setup.py';f=getattr(tokenize, 'open', open) 
(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, 
__file__, 'exec'))" install --record C:UsersastrinaAppDataLocalTemppip- 
record-va173t5vinstall-record.txt --single-version-externally-managed -- 
compile" failed with error code 1 in C:UsersastrinaAppDataLocalTemppip- 
install-40l_x_f4mysqlclient

I’ve already installed Microsoft Build Tools 2015 but the problem persist

Advertisement

Answer

First install python 3.6.5, then run

pip install mysqlclient==1.3.12
Advertisement