zoukankan      html  css  js  c++  java
  • Python 2.7 中安装 MySQL-python 提示 ERROR: Command errored out with exit status 1

    Python 2.7 中安装 MySQL-python 提示 ERROR: Command errored out with exit status 1

      在Python 2.7 中安装 MySQL-python 时提示说 C++ 有问题,然后我就找到对应的 C++ 安装包,安装好后再次提醒错误 ERROR: Command errored out with exit status 1等等。
      首先,我在网上找到了对应的 C++ 安装包。然后进行了安装。下载地址 提取码:xoz2
      安装完以后,重启电脑,再次出现错误,提示:ERROR: Command errored out with exit status 1。具体错误信息如下:

    ......
    creating build	emp.win32-2.7
        creating build	emp.win32-2.7Release
        C:UsersEDZAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCBincl.exe /c /nologo /Ox /MD
     /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:Program Files (x86)MySQLMySQL Conne
    ctor C 6.0.2include" -Ic:python27include -Ic:python27PC /Tc_mysql.c /Fobuild	emp.win32-2.7Release\_mysql.obj
     /Zl
        _mysql.c
        _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
        error: command 'C:\Users\EDZ\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bi
    n\cl.exe' failed with exit status 2
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:python27python.exe' -u -c 'import sys, setuptools, tokenize; s
    
                                                                       _mysql.c
        _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
        error: command 'C:\Users\EDZ\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\B
    in\cl.exe' failed with exit status 2
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:python27python.exe' -u -c 'import sys, setuptools, tokenize; s
    ys.argv[0] = '"'"'c:\users\edz\appdata\local\temp\pip-install-30w9j7\mysql-python\setup.py'"'"'; __file__=
    '"'"'c:\users\edz\appdata\local\temp\pip-install-30w9j7\mysql-python\setup.py'"'"';f=getattr(tokenize, '"'
    "'open'"'"', open)(__file__);code=f.read().replace('"'"'
    '"'"', '"'"'
    '"'"');f.close();exec(compile(code, __fi
    le__, '"'"'exec'"'"'))' install --record 'c:usersedzappdatalocal	emppip-record-ms4ymtinstall-record.txt' --
    single-version-externally-managed --compile --install-headers 'c:python27IncludeMySQL-python' Check the logs fo
    r full command output.
    

      这个问题大概分三步解决:
      1. 下载 MySQL-python 或者是 Mysqlclient的.whl 包,注意对应自己安装的python版本,如何使32 bit就下载对应32位的版本;

    Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)] on win32
    

      如上,我的是win32的,我选如下:

    MySQL-python: a Python database API 2.0 interface for the MySQL database
    Consider mysqlclient, a Python 3 compatible fork of MySQL-python.
    
    MySQL_python‑1.2.5‑cp27‑none‑win32.whl
    

      下载以后进行安装,如下:

    pip install pathMySQL_python-1.2.5-cp27-none-win32.whl
    

      安装完成以后,使用pip list进行查看,MySQL-python 安装成功。

  • 相关阅读:
    HashCode的作用
    为什么重写equals一定要重写hashcode?
    java timer 定时器原理
    java内部类作用
    jeesite添加多数据源
    Eclipse之安装Jadclipse插件直接查看class文件
    NIO和IO的主要区别
    sql 语句
    HTTP Error 500.0
    基于.NetCore3.1系列 ——认证授权方案之Swagger加锁
  • 原文地址:https://www.cnblogs.com/ZN-225/p/14704502.html
Copyright © 2011-2022 走看看