简体   繁体   English

如何修复 pip install MySQL-python 出现的错误

[英]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. C:\Windows\system32>pip install MySQL-python 使用缓存的 MySQL-python-1.2.5.zip 收集 MySQL-python (108 kB) 使用旧版 setup.py 安装 MySQL-python,因为未安装 package 'wheel'。 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;安装收集的包:MySQL-python 运行 setup.py install for MySQL-python...错误错误:命令出错,退出状态为 1:命令:'C:\Users\Pavan P\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation .Python.3.8_qbz5n2kfra8p0\python.exe' -u -c '导入系统、设置工具、标记化; sys.argv[0] = '"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"'; 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 file ='"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"';f=getattr(tokenize, '"'" '打开'"'"', 打开)(文件);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完成 output(24 行):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 复制 MySQLdb_ init .py -> build\lib.win-amd64-3.8\MySQLdb 复制 MySQLdb\converters.py -> build\lib.win-amd64-3.8\MySQLdb 复制 MySQLdb\connections.py -> build\lib .win-amd64-3.8\MySQLdb 复制 MySQLdb\cursors.py -> build\lib.win-amd64-3.8\MySQLdb 复制 MySQLdb\release.py -> build\lib.win-amd64-3.8\MySQLdb 复制 MySQLdb\times .py -> build\lib.win-amd64-3.8\MySQLdb 创建 build\lib.win-amd64-3.8\MySQLdb\constants 复制 MySQLdb\constants_ init _.py -> build\lib.win-amd64-3.8\MySQLdb \constants 复制 MySQLdb\constants\CR.py -> build\lib.win-amd64-3.8\MySQLdb\constants 复制 MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.8\MySQLdb\constants 复制 MySQLdb \constants\ER.py -> build\lib.win-amd64-3.8\MySQLdb\constants 复制 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. \FLAG.py -> build\lib.win-amd64-3.8\MySQLdb\constants 复制 MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.8\MySQLdb\constants 复制 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;通过“Visual Studio 构建工具”获取: https://visualstudio.microsoft.com/downloads/ -------------------------- ---------- 错误:命令出错,退出状态为 1:'C:\Users\Pavan P\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c '导入系统、设置工具、标记化; sys.argv[0] = '"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"'; 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. file ='"'"'C:\Users\Pavan P\AppData\Local\Temp\pip-install-6b6uth5n\MySQL-python\setup.py'"'"';f=getattr(tokenize, '"'" '打开'"'"', 打开)(文件);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' 检查日志中的完整命令 output。

you do not need to install visual studio build tools, instead, try installing the following modules which are all the same ones,您不需要安装 Visual Studio 构建工具,而是尝试安装以下相同的模块,

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这是错误,看来您需要安装 MS Visual C++ 14.0

error: Microsoft Visual C++ 14.0 is required.错误:需要 Microsoft Visual C++ 14.0。 Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ ---------------------------------------- ERROR: Command errored out with exit status 1使用“Visual Studio 构建工具”获取它: https ://visualstudio.microsoft.com/downloads/ ------------------------- ------------- 错误:命令出错,退出状态为 1

I got the same error when I was trying to install pip install MySQL-python .我在尝试安装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.而不是安装 Visual Studio 构建工具,错误已得到修复。

The fastest and best way you solve your issues is modules whl.解决问题最快最好的方法是模块 whl。 python -m pip install mysqlclient==1.4.2.post1 python -m pip 安装mysqlclient==1.4.2.post1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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