Windows Python2.7 mysqldb安装错误 [英] Windows Python2.7 mysqldb installation error

查看:62
本文介绍了Windows Python2.7 mysqldb安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Python安装mysqldb. 我正在运行"pip install mysql-python" 而且我不断收到此错误:

I'm trying to install mysqldb for Python. I'm running "pip install mysql-python" and I keep getting this error:

运行build_ext
建立'_mysql'扩展名
创建build \ temp.win32-2.7
创建build \ temp.win32-2.7 \ Release
C:\ Program Files(x86)\ Common Files \ Microsoft \ Visual C ++ for Python \ 9.0 \ VC \ Bin \ cl.exe/c/nologo/Ox/MD/W3/GS-/DNDEBUG -Dversion_info =(1,2 ,5,'fi nal',1)-D__version __ = 1.2.5"-IC:\ Program Files(x86)\ MySQL \ MySQL Connector C 6.0.2 \ include" -Ic:\ python27 \ include -Ic:\ python27 \ PC/Tc_mysql. c/福贝 ld \ temp.win32-2.7 \ Release_mysql.obj/Zl _mysql.c
_mysql.c(42):致命错误C1083:无法打开包含文件:'config-win.h':没有这样的文件或目录
错误:命令"C:\ Program Files(x86)\ Common Files \ Microsoft \ Visual C ++ for Python \ 9.0 \ VC \ Bin \ cl.exe"失败,退出状态为2

running build_ext
building '_mysql' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'fi nal',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fobui ld\temp.win32-2.7\Release_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:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

----------------------------------------
mysql-python的构建轮失败
无法建立mysql-python
安装收集的软件包:mysql-python
为mysql-python运行setup.py install
来自命令c:\ python27 \ python.exe -c"import setuptools,tokenize; 文件 ='c:\ users \ scott〜1.sco \ appdata \ local \ temp \ pip-bu的完整输出 ild-nja4gr \ mysql-python \ setup.py'; exec(compile(getattr(tokenize,'open',open)( file ).read().replace('\ r \ n' ,'\ n'),文件,'exec'))安装- -record c:\ users \ scott〜1.sco \ appdata \ local \ temp \ pip-5htk1y-record \ install-record.txt --single-version-externally-managed --compile: 正在运行安装
正在运行构建
运行build_py
复制MySQLdb \ release.py-> build \ lib.win32-2.7 \ MySQLdb
运行build_ext
建立'_mysql'扩展名
C:\ Program Files(x86)\ Common Files \ Microsoft \ Visual C ++ for Python \ 9.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" -Ic:\ python27 \ include -Ic:\ python27 \ PC/Tc_mysql. c/离岸价 uild \ temp.win32-2.7 \ Release_mysql.obj/Zl _mysql.c
_mysql.c(42):致命错误C1083:无法打开包含文件:'config-win.h':没有这样的文件或目录
错误:命令"C:\ Program Files(x86)\ Common Files \ Microsoft \ Visual C ++ for Python \ 9.0 \ VC \ Bin \ cl.exe"失败,退出状态为2

----------------------------------------
Failed building wheel for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
Complete output from command c:\python27\python.exe -c "import setuptools, tokenize;file='c:\users\scott~1.sco\appdata\local\temp\pip-bu ild-nja4gr\mysql-python\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install - -record c:\users\scott~1.sco\appdata\local\temp\pip-5htk1y-record\install-record.txt --single-version-externally-managed --compile: running install
running build
running build_py
copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb
running build_ext
building '_mysql' extension
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.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" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fob uild\temp.win32-2.7\Release_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:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

----------------------------------------

命令"c:\ python27 \ python.exe -c"导入设置工具,标记化; 文件 ='c:\ users \ scott〜1.sco \ appdata \ local \ temp \ pip- build-nja4gr \ mysql-python \ setup.py'; exec(compile(getattr(tokenize,'open',open)( file ).read().replace('\ r \ n','\ n'), 文件,"exec"))"安装--record c:\ users \ scott〜1 .sco \ appdata \ local \ temp \ pip-5htk1y-record \ install-record.txt --single-version-externally-managed --compile在c:\ users \ scott中失败,错误代码为1 〜1.sco \ appdata \ local \ temp \ pip-build-nja4gr \ mysql-python

Command "c:\python27\python.exe -c "import setuptools, tokenize;file='c:\users\scott~1.sco\appdata\local\temp\pip-build-nja4gr\mysql-python \setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\scott~1 .sco\appdata\local\temp\pip-5htk1y-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\scott ~1.sco\appdata\local\temp\pip-build-nja4gr\mysql-python

谁能告诉我是什么问题?

Can anyone tell me whats the problem?

推荐答案

从下面的位置,从Christophe Gohlke的Windows预编译python软件包库中下载mysql-python的预编译whl文件.

Download the pre-compiled whl file for mysql-python from from Christophe Gohlke’s Library of pre-compiled python packages for windows from the below location.

https://www.lfd.uci.edu/~ gohlke/pythonlibs/#mysql-python

现在进入下载该文件的目录,并在该目录中打开命令提示符.

Now got to directory where you downloaded that file and open command prompt there.

现在在命令pip install xxx.whl

祝你好运!

这篇关于Windows Python2.7 mysqldb安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆