使用pip安装mysql-python,获取“mysql-python构建轮失败”

时间:2016-08-23 19:24:09

标签: python mysql

因此在尝试使用pip安装mysql-python之后,它说“错误:需要Microsoft Visual C ++ 10.0。使用”Microsoft Windows SDK 7.1“获取它

这是我的日志:

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Users\Ryan> cd\
PS C:\> cd python34\flaskapp\pythonappnew
PS C:\python34\flaskapp\pythonappnew> pip install mysql-python
Collecting mysql-python
  Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
  Running setup.py bdist_wheel for mysql-python ... error
  Complete output from command c:\Python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ryan\\AppData\\Local\\Temp\\pip-build-ogoer034\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\Ryan\AppData\Local\Temp\tmpwdwnr_thpip-wheel- --python-tag cp34:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.4
  copying _mysql_exceptions.py -> build\lib.win-amd64-3.4
  creating build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\__init__.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\converters.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\connections.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\cursors.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\release.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\times.py -> build\lib.win-amd64-3.4\MySQLdb
  creating build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\__init__.py -> build\lib.win-amd64 3.4\MySQLdb\constants
  copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  running build_ext
  building '_mysql' extension
  error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

  ----------------------------------------
  Failed building wheel for mysql-python
  Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
  Running setup.py install for mysql-python ... error
    Complete output from command c:\Python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ryan\\AppData\\Local\\Temp\\pip-build-ogoer034\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Ryan\AppData\Local\Temp\pip-jx3ujzg8-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.4
    copying _mysql_exceptions.py -> build\lib.win-amd64-3.4
    creating build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\release.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\times.py -> build\lib.win-amd64-3.4\MySQLdb
    creating build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64 3.4\MySQLdb\constants
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.4\MySQLdb\constants
    running build_ext
    building '_mysql' extension
    error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

    ----------------------------------------
Command "c:\Python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Ryan\\AppData\\Local\\Temp\\pip-build-ogoer034\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Ryan\AppData\Local\Temp\pip-jx3ujzg8-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Ryan\AppData\Local\Temp\pip-build-ogoer034\mysql-python\

PS C:\python34\flaskapp\pythonappnew>

所以从谷歌搜索:我发现了一些我尝试过的解决方案。我已经卸载了已安装的Microsoft Visual C ++ 2010 Redistributable。

然后我尝试安装Microsoft Windows SDK 7.1但是当我打开安装程序时它说已经安装了.NET Framework 4。所以我卸载它,发现它预先包含在Windows 10中。所以它不会让我安装Microsoft C ++ 2010编译器或其他什么,我认为这可能是我遇到的问题?编译器需要净框架4.

所以我找到了另一个解决方案,说我可以在我的注册表中更改Framework 4的版本号,这样我就可以继续安装SDK 7.1了。然而,这不起作用。

总结我的故障排除过程:

我尝试使用SDK 7.1,它说我需要net framework 4,即使它已经包含在Windows中(我认为这是人们所说的)。所以我试图从添加或删除程序卸载框架并重新安装它。但是当我重新安装框架4时,它说它已经安装好了。当我转到SDK 7.1时,它说它已被卸载。我想做的就是用pip lol安装mysql-python ......

0 个答案:

没有答案