简体   繁体   English

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

[英]Can't install mysql-python (newer versions) in Windows

I have mysql-python v1.2.4 installed just fine on my machine (Windows 8). 我在我的机器(Windows 8)上安装了mysql-python v1.2.4。 I am using Python 2.7. 我正在使用Python 2.7。 I always got this below error every time I try to upgrade to v1.2.5. 每当我尝试升级到v1.2.5时,总是会收到以下错误消息。 (still happens as of v1.3.7) (从v1.3.7开始仍然发生)

 C:\\Users\\User\\AppData\\Local\\Programs\\Common\\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 /Fobuild\\temp.wi n32-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:\\Users\\User\\AppData\\Local\\Programs\\Common\\Microsoft \\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2 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 /Fobuild\\temp.wi n32-2.7 \\ Release_mysql.obj / Zl _mysql.c _mysql.c(42):致命错误C1083:无法打开包含文件:'config-win.h':没有此类文件或目录错误:命令'C:\\ Users \\ User \\ AppData \\ Local \\ Programs \\ Common \\ Microsoft \\ Visual C ++ for Python \\ 9.0 \\ VC \\ Bin \\ cl.exe'失败,退出状态为2

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

setuptools, tokenize; setuptools,标记化; file ='c:\\ \\users\\user\\appdata\\local\\temp\\pip-build-utz7of\\MySQL-python\\setup.py';ex ec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\\r\\n', '\\n' ), file , 'exec'))" install --record c:\\users\\user\\appdata\\local\\temp\\pip-osy _cg-record\\install-record.txt --single-version-externally-managed --compile" fai led with error code 1 in c:\\users\\user\\appdata\\local\\temp\\pip-build-utz7of\\MySQL -python\\ 文件 ='c:\\\\ users \\ user \\ appdata \\ local \\ temp \\ pip-build-utz7of \\ MySQL-python \\ setup.py';例如ec(compile(getattr(tokenize,'open',open)( file ) .read()。replace('\\ r \\ n','\\ n'), file ,'exec'))“安装--record c:\\ users \\ user \\ appdata \\ local \\ temp \\ pip-osy _cg- record \\ install-record.txt-“单一版本-外部管理-编译” fai在c:\\ users \\ user \\ appdata \\ local \\ temp \\ pip-build-utz7of \\ MySQL -python \\中导致错误代码1

I've tried (and none work): 我已经尝试过了(没有任何工作):

  1. Installing VS2010 安装VS2010
  2. Changing Python Path 改变Python路径
  3. Using Wheel module (I got Failed building wheel for MySQL-python ) 使用Wheel模块(我Failed building wheel for MySQL-pythonFailed building wheel for MySQL-python
  4. Installing Python MySQL connector. 安装Python MySQL连接器。 For both Python and C. 对于Python和C。
  5. Installing mysqlclient 安装mysqlclient
  6. Installing using Exe installer from https://pypi.python.org/pypi/mysql-python/1.2.5 https://pypi.python.org/pypi/mysql-python/1.2.5使用Exe安装程序进行安装

Do I miss something? 我想念什么吗? Thanks. 谢谢。

I solved it myself. 我自己解决了。

I use the wheel installer from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python . 我从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. amd64一个拒绝在我的平台(Windows)上安装,但另一个可以正常工作。 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. 然后通过在wheel包所在的同一文件夹中运行以下命令来安装它。

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

Python 3.7 Python 3.7

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM