无法在 Windows 中安装 mysql-python(较新版本)

Can#39;t install mysql-python (newer versions) in Windows(无法在 Windows 中安装 mysql-python(较新版本))

本文介绍了无法在 Windows 中安装 mysql-python(较新版本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的机器上安装了 mysql-python v1.2.4(Windows 8).我正在使用 Python 2.7.每次尝试升级到 v1.2.5 时,我总是遇到以下错误.(从 v1.3.7 开始仍然发生)<块引用>

C:UsersUserAppDataLocalProgramsCommonMicrosoftVisual C++ for Python

9.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 Connector C 6.0.2include" -Ic:python27include -Ic:python27PC/Tc_mysql.c/Fobuild emp.wi n32-2.7Release_mysql.obj/Zl_mysql.c_mysql.c(42):致命错误 C1083:无法打开包含文件:'config-win.h':没有那个文件或目录错误:命令 'C:UsersUserAppDataLocalProgramsCommonMicrosoftVisualC++ for Python9.0VCBincl.exe' 失败,退出状态 2

---------------------------------------- 回滚卸载mysql-python 命令c:python27python.exe -u -c"导入

setuptools, tokenize;file='c:\usersuserappdatalocal emppip-build-utz7ofMySQL-pythonsetup.py';exec(compile(getattr(tokenize, 'open',open)(file).read().replace(' ', ' ' ), file, 'exec'))"安装 --record c:usersuserappdatalocal emppip-osy_cg-recordinstall-record.txt --single-version-externally-managed --compile" fai 在 c:usersuserappdatalocal emppip-build-utz7ofMySQL 中显示错误代码 1-python

我尝试过(但没有成功):

  1. 安装 VS2010
  2. 更改 Python 路径
  3. 使用 Wheel 模块(我得到 失败的 MySQL-python 构建轮子)
  4. 安装 Python MySQL 连接器.适用于 Python 和 C.
  5. 安装mysqlclient
  6. 使用来自 https://pypi.python.org/的 Exe 安装程序进行安装pypi/mysql-python/1.2.5

我错过了什么吗?谢谢.

解决方案

我自己解决了.

我使用来自 http://www.lfd 的轮子安装程序.uci.edu/~gohlke/pythonlibs/#mysql-python.

那里有两个轮子包.amd64 一个拒绝安装在我的平台 (Windows) 上,但另一个工作正常.我的意思是具有此名称的文件:

MySQL_python-1.2.5-cp27-none-win32.whl

然后通过在与wheel包相同的文件夹中运行以下命令来安装它.

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

Python 3.7

使用mysqlclient‑1.3.13‑cp37‑cp37m‑win32.whl

I have mysql-python v1.2.4 installed just fine on my machine (Windows 8). I am using Python 2.7. I always got this below error every time I try to upgrade to v1.2.5. (still happens as of v1.3.7)

C:UsersUserAppDataLocalProgramsCommonMicrosoftVisual C++ for Python

9.0VCBincl.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)MySQLMySQL Connector C 6. 0.2include" -Ic:python27include -Ic:python27PC /Tc_mysql.c /Fobuild emp.wi n32-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:UsersUserAppDataLocalProgramsCommonMicrosoft Visual C++ for Python9.0VCBincl.exe' failed with exit status 2

----------------------------------------   Rolling back uninstall of mysql-python Command "c:python27python.exe -u -c "import

setuptools, tokenize;file='c: usersuserappdatalocal emppip-build-utz7ofMySQL-pythonsetup.py';ex ec(compile(getattr(tokenize, 'open', open)(file).read().replace(' ', ' ' ), file, 'exec'))" install --record c:usersuserappdatalocal emppip-osy _cg-recordinstall-record.txt --single-version-externally-managed --compile" fai led with error code 1 in c:usersuserappdatalocal emppip-build-utz7ofMySQL -python

I've tried (and none work):

  1. Installing VS2010
  2. Changing Python Path
  3. Using Wheel module (I got Failed building wheel for MySQL-python)
  4. Installing Python MySQL connector. For both Python and C.
  5. Installing mysqlclient
  6. Installing using Exe installer from https://pypi.python.org/pypi/mysql-python/1.2.5

Do I miss something? Thanks.

解决方案

I solved it myself.

I use the wheel installer from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python.

There are two wheel packages there. The amd64 one refuses to install on my platform (Windows) but the other one works just fine. I mean the file with this name:

MySQL_python-1.2.5-cp27-none-win32.whl

Then install it by running this below command in the same folder with the wheel package.

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

Python 3.7

Use mysqlclient‑1.3.13‑cp37‑cp37m‑win32.whl

这篇关于无法在 Windows 中安装 mysql-python(较新版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法在 Windows 中安装 mysql-python(较新版本)