【问题标题】:Error while trying to install MySQL onto Python3.4尝试将 MySQL 安装到 Python3.4 时出错
【发布时间】:2015-07-17 15:45:08
【问题描述】:

我已经在命令行中运行了以下命令。执行和错误请看代码末尾:

_mysql.c(42) : 致命错误 C1083: 无法打开包含文件: 'config-win.h': 没有这样的文件或目录

错误:命令 'C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl .exe' 失败,退出状态为 2

D:\Python34>pip install MySQL-python


Collecting MySQL-python
  Using cached MySQL-python-1.2.5.zip
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python
    Complete output from command D:\Python34\python.exe -c "import setuptools, t
okenize;__file__='C:\\Users\\Irfan\\AppData\\Local\\Temp\\pip-build-i5dqkio1\\My
SQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).rea
d().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Irfan\A
ppData\Local\Temp\pip-v08vge52-record\install-record.txt --single-version-extern
ally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.4
    copying _mysql_exceptions.py -> build\lib.win32-3.4
    creating build\lib.win32-3.4\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win32-3.4\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win32-3.4\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win32-3.4\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win32-3.4\MySQLdb
    copying MySQLdb\release.py -> build\lib.win32-3.4\MySQLdb
    copying MySQLdb\times.py -> build\lib.win32-3.4\MySQLdb
    creating build\lib.win32-3.4\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.4\MySQLdb\constan
ts
    copying MySQLdb\constants\CR.py -> build\lib.win32-3.4\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.4\MySQLdb\const
ants
    copying MySQLdb\constants\ER.py -> build\lib.win32-3.4\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.4\MySQLdb\constants
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.4\MySQLdb\constant
s
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.4\MySQLdb\constants

    running build_ext
    building '_mysql' extension
    creating build\temp.win32-3.4
    creating build\temp.win32-3.4\Release
    C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /
MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\
Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -ID:\Python34\include
 -ID:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.obj /Z
l
    _mysql.c
    _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':
No such file or directory
    error: command 'C:\\Program Files\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl
.exe' failed with exit status 2

    ----------------------------------------
    Command "D:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:
\\Users\\Irfan\\AppData\\Local\\Temp\\pip-build-i5dqkio1\\MySQL-python\\setup.py
';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n',
'\n'), __file__, 'exec'))" install --record C:\Users\Irfan\AppData\Local\Temp\pi
p-v08vge52-record\install-record.txt --single-version-externally-managed --compi
le" failed with error code 1 in C:\Users\Irfan\AppData\Local\Temp\pip-build-i5dq
kio1\MySQL-python
   

【问题讨论】:

  • 可以提供更具体的内容吗?脚本代码,安装过程说明?或者我们应该通过问大卫科波菲尔来猜测你的问题?

标签: python mysql django


【解决方案1】:

MySQL-Python 与 Python 3.4 不兼容。请使用mysqlclient https://pypi.python.org/pypi/mysqlclient

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-01
    • 1970-01-01
    • 2017-09-15
    • 2017-10-11
    • 2015-01-17
    • 2013-11-13
    • 2018-03-05
    • 2015-12-18
    相关资源
    最近更新 更多