• 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
    
    • 1

    提示错误:

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

    原因是系统中没有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是你下载的文件的全名

  • 相关阅读:
    前端工程师-----HTML篇(引用牛客)
    设置远程服务器共享本地磁盘
    探花交友_第5章_圈子、小视频功能实现
    58、ElasticSearch DSL Bucket聚合
    是时候和 Confluence 说再见了
    1.【刷爆LeetCode】替换空格(多方法、多思路解决)
    438.找到字符串中所有的字母异位词
    python一点通:数据处理顶流Pandas 2.0有什么新功能?
    海盗王3.0版本60帧版的体验
    卷积神经网络(CNN)识别眼睛状态
  • 原文地址:https://blog.csdn.net/weixin_44887276/article/details/126136535