Install mysqldb under Windows python

Source: Internet
Author: User

Install mysqldb need to install MySQL connector C on the computer, just need this connector just fine, do not need to put MySQL full.

In addition, you need to install VC for Python to provide compilation.

Download the script on the official website to install, unzip the package, CMD to the target directory, Python setup.py install.

General installation error, indicating that "config_win.h" could not be found

MYSQL.C: Fatal error C1083:cannot open include file: ' Config-win.h ': No such file or directory
Error:command ' "C:/Program files/microsoft Visual Studio 9.0/vc/bin/cl.exe" ' failed with exit status 2

If you are using MySQLdb 1.2.3, make the following changes: Open setup_windows.py, change mysql_root to MySQL Connector c directory

#serverKey = _winreg. Openkey (_winreg. hkey_local_machine,options[' Registry_key ')

#mysql_root, dummy = _winreg. QueryValueEx (Serverkey, ' location ')

Mysql_root = r "F:\devtools\MySQL\MySQL Connector C 6.0.2"

This problem if you use the latest MySQLdb 1.2.5, then modify the Site.cfg file in the directory

connector = C:\Program Files\MySQL\Connector C 6.0.2

If you can not install after the change, then remember to check the version of MySQL connector, the current official website provides the latest version of 6.1.6, note that this version is not config_win.h this file at all.

Therefore, please uninstall this version and then choose to install the historical version provided by the official website 6.0.2, should be able to install successfully.

Install mysqldb under Windows python

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.