How to fix the error coming pip install MySQL-python

Question:

C:Windowssystem32>pip install MySQL-python
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip (108 kB)
Using legacy setup.py install for MySQL-python, since package ‘wheel’ is not installed.
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python … error
ERROR: Command errored out with exit status 1:
command: ‘C:UsersPavan PAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’C:UsersPavan PAppDataLocalTemppip-install-6b6uth5nMySQL-pythonsetup.py’"’"’; file=’"’"’C:UsersPavan PAppDataLocalTemppip-install-6b6uth5nMySQL-pythonsetup.py’"’"’;f=getattr(tokenize, ‘"’"’open’"’"’, open)(file);code=f.read().replace(‘"’"’rn’"’"’, ‘"’"’n’"’"’);f.close();exec(compile(code, file, ‘"’"’exec’"’"’))’ install –record ‘C:UsersPavan PAppDataLocalTemppip-record-lt8udbbuinstall-record.txt’ –single-version-externally-managed –user –prefix= –compile –install-headers ‘C:UsersPavan PAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0LocalCachelocal-packagesPython38IncludeMySQL-python’
cwd: C:UsersPavan PAppDataLocalTemppip-install-6b6uth5nMySQL-python
Complete output (24 lines):
running install
running build
running build_py
creating build
creating buildlib.win-amd64-3.8
copying mysql_exceptions.py -> buildlib.win-amd64-3.8
creating buildlib.win-amd64-3.8MySQLdb
copying MySQLdb_init
.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbconverters.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbconnections.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbcursors.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbrelease.py -> buildlib.win-amd64-3.8MySQLdb
copying MySQLdbtimes.py -> buildlib.win-amd64-3.8MySQLdb
creating buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstants_init_.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsREFRESH.py -> buildlib.win-amd64-3.8MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.8MySQLdbconstants
running build_ext
building ‘_mysql’ extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
—————————————-
ERROR: Command errored out with exit status 1: ‘C:UsersPavan PAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’C:UsersPavan PAppDataLocalTemppip-install-6b6uth5nMySQL-pythonsetup.py’"’"’; file=’"’"’C:UsersPavan PAppDataLocalTemppip-install-6b6uth5nMySQL-pythonsetup.py’"’"’;f=getattr(tokenize, ‘"’"’open’"’"’, open)(file);code=f.read().replace(‘"’"’rn’"’"’, ‘"’"’n’"’"’);f.close();exec(compile(code, file, ‘"’"’exec’"’"’))’ install –record ‘C:UsersPavan PAppDataLocalTemppip-record-lt8udbbuinstall-record.txt’ –single-version-externally-managed –user –prefix= –compile –install-headers ‘C:UsersPavan PAppDataLocalPackagesPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0LocalCachelocal-packagesPython38IncludeMySQL-python’ Check the logs for full command output.

Asked By: Pavan P

||

Answers:

Here is the error, looks like you need to install MS visual C++ 14.0

error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools
for Visual Studio": https://visualstudio.microsoft.com/downloads/
—————————————- ERROR: Command errored out with exit status 1

Answered By: Isaiah4110

you do not need to install visual studio build tools, instead, try installing the following modules which are all the same ones,

pip install pymysql
pip install mysql-connector
pip install mysql-connector-python

Note:

all the modules listed here are the same thing

Answered By: Ahmad Waqar

The fastest and best way you solve your issues is modules whl.
python -m pip install mysqlclient==1.4.2.post1

Answered By: d3vkidhash
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.