python安装mysqldb报错

报错内容如下,这个安装失败了,原因和解决方法看下这里:
https://blog.csdn.net/asty9000/article/details/89175192

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop supp
ort for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-
support pip 21.0 will remove support for this functionality.
Collecting MySQL-python
Downloading MySQL-python-1.2.5.zip (108 kB)
|████████████████████████████████| 108 kB 168 kB/s
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:\python27\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’“‘c:\users\v_xuew~1\appdata\local\temp\pip-install-bcdbv4\m
ysql-python\setup.py’”’“‘; file=’”‘“‘c:\users\v_xuew~1\appdata\local\temp\pip-install-bcdbv4\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\v_xue
w~1\appdata\local\temp\pip-record-bqpomb\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘c:\python27\Include\MySQL-python’
cwd: c:\users\v_xuew~1\appdata\local\temp\pip-install-bcdbv4\mysql-python
Complete output (24 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
copying mysql_exceptions.py -> build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb_init
.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-2.7\MySQLdb
creating build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants_init_.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-2.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-2.7\MySQLdb\constants
running build_ext
building ‘_mysql’ extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
----------------------------------------
ERROR: Command errored out with exit status 1: ‘c:\python27\python.exe’ -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '”‘“‘c:\users\v_xuew~1\appdata\l
ocal\temp\pip-install-bcdbv4\mysql-python\setup.py’”’“‘; file=’”‘“‘c:\users\v_xuew~1\appdata\local\temp\pip-install-bcdbv4\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\v_xuew~1\appdata\local\temp\pip-record-bqpomb\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘c:\p
ython27\Include\MySQL-python’ Check the logs for full command output.

windows下pip在线安装MySQL-python时:

python -m pip install MySQL-python

提示错误:

error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpyt
hon27

原因是系统中没有python安装所需的C++编译器。

解决方法:

1.安装VS2005或VS2008,安装完成后再安装MySQL-python。

2.从错误信息中指定的地址下载Microsoft Visual C++ Compiler for Python 2.7,安装完成后再安装MySQL-python。

3.从资源网站找到中找到mysql-python,选择合适的版本进行安装,如果没有合适的版本则只能通过前两种方式解决。
————————————————
版权声明:本文为CSDN博主「荣耀之路」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/asty9000/article/details/89175192

我用的方法3,下载下来之后,cmd里面 【pip install xxxx】xxxx是你下载的文件的全名

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值