简体   繁体   中英

How to fix the error coming pip install MySQL-python

C:\Windows\system32>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:\Users\Pavan P\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"'; file ='"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)( file );code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file , '"'"'exec'"'"'))' install --record 'C:\Users\Pavan P\AppData\Local\Temp\pip-record-lt8udbbu\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Pavan P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Include\MySQL-python' cwd: C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python
Complete output (24 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.8 copying mysql_exceptions.py -> build\lib.win-amd64-3.8 creating build\lib.win-amd64-3.8\MySQLdb copying MySQLdb_ init .py -> build\lib.win-amd64-3.8\MySQLdb copying MySQLdb\converters.py -> build\lib.win-amd64-3.8\MySQLdb copying MySQLdb\connections.py -> build\lib.win-amd64-3.8\MySQLdb copying MySQLdb\cursors.py -> build\lib.win-amd64-3.8\MySQLdb copying MySQLdb\release.py -> build\lib.win-amd64-3.8\MySQLdb copying MySQLdb\times.py -> build\lib.win-amd64-3.8\MySQLdb creating build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants_ init _.py -> build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants \FLAG.py -> build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.8\MySQLdb\constants copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.8\MySQLdb\constants 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:\Users\Pavan P\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"'; file ='"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)( file );code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file , '"'"'exec'"'"'))' install --record 'C:\Users\Pavan P\AppData\Local\Temp\pip-record-lt8udbbu\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Pavan P\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Include\MySQL-python' Check the logs for full command output.

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

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

I got the same error when I was trying to install pip install MySQL-python . Then I tried,

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

instead of installing visual studio build tools and the error was fixed.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM