Windows Python Mysql-python installation process

Source: Internet
Author: User
Tags python mysql

Problem Statement:

Pip Install mysql-python==1.2.5
The following error occurred:

C:\Users\Administrator\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\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:\progra~2\jetbra~1\python~1\saplat~1\PC /Tc_mysql.c /Fobuild\temp.win-amd64-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\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe‘ failed with exit status 2
Operating Environment:

Windows Ten x64
Python 2.7.14
Pip 9.0.1

Workaround:

See PIP installation error about "MySQL Connector C 6.0.2", need to install the corresponding driver package, see below,

    • Install MySQL connector, must install 32 bit (special),:
      Http://dev.mysql.com/downloads/connector/c/6.0.html#downloads

    • To install Microsoft Visual C + + Compiler for Python 2.7, if installing mysql-python requires even some of the VC's runtime libraries:
      http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

After you install Python under Win7 and want to install Python-mysql, the following issues occur with PIP installation:

    • Pip Install Mysql-python

      build\lib.win-amd64-2.7\_mysql.pyd : fatal error LNK1120: 56 unresolved externalserror: command ‘C:\\Users\\Administrator\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe‘ failed with exit status 1120

      The general explanation on the web is that reinstalling MySQL and installing MySQL is the option to install C + + compilers ...
      I have not tried, but it certainly does not work ah, I just want to install a python can be remotely connected to the MySQL package, tube local MySQL what? Some explanations are really fraught.
      But in the error hints also thanks to the lack of C + + environment, and later found on the Internet method:
      Here's how:
      1. In http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python download the corresponding package version, if it is Win7 64 bit 2.7 version of Python, download
      Mysql_python-1.2.5-cp27-none-win_amd64.whl
      Then execute pip install MYSQL_PYTHON-1.2.5-CP27-NONE-WIN_AMD64.WHL at the command line
      Of course you need to jump to the directory under CMD to download MYSQL_PYTHON-1.2.5-CP27-NONE-WIN_AMD64.WHL
      And then the installation was successful Mysql-python

    • Reference Links:
      Http://www.cnblogs.com/fnng/p/4115607.html

Windows Python Mysql-python installation process

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.