• 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是你下载的文件的全名

  • 相关阅读:
    阶段三:项目开发---大数据开发运行环境搭建:任务2:安装配置ZooKeeper
    hive创建分区表
    5 评价类算法:CRITIC法笔记(附Python代码)
    数据结构学习笔记——顺序存储结构实现串
    C++学习day4
    Win11找不到组策略编辑器(gpedit.msc)解决
    算法-动态规划专题
    互联网摸鱼日报(2022-11-11)
    Podman Desktop安装与使用-Windows10
    【Linux】线程同步与互斥
  • 原文地址:https://blog.csdn.net/weixin_44887276/article/details/126136535