Win64 bit installation python-mysqldb1.2.5

Source: Internet
Author: User
Tags win32

There is a problem with the time query in other versions of MYSQLDB
Finally determine whether or in the 1.2.5 version of the solution, the problem that needs to be solved is this:
"Cannot open include file: ' Config-win.h ': No such file or directory" while installing Mysql-python

The above is on the 1.2.4 version, and later on the 1.2.5 should be resolved. But in fact, 1.2.5 in the Windows 64-bit environment is still problematic, for reasons see the following explanation.

The installation steps are as follows:
1. Install Microsoft Visual C + + Compiler package for Python 2.7
Download link

2. Install MySQL Connector C 6.0.2
Download link

3. Download Mysql-python 1.2.5 Source Package
Download link

4. After extracting the source package, modify the Site.cfg file.
In fact, if you are deploying on a 32-bit system, install Mysql-python 1.2.5 with PIP install just by installing the dependency package above.
However, in a 64-bit environment, you will be prompted with "Cannot open include file: ' Config-win.h '" error.
The reason is that MySQL Connector C, written in Site.cfg, is a 32-bit version.

The original Site.cfg file contents are as follows:

Reference # HTTP://STACKOVERFLOW.COM/QUESTIONS/1972259/MYSQL-PYTHON-INSTALL-PROBLEM-USING-VIRTUALENV-WINDOWS-PIP
# Windows Connector libs for MySQL. You need a 32-bit connector for your 32-bit Python build.
Connector = C:\Program Files (x86) \mysql\mysql connector C 6.0.2

Modified to:

Reference Connector = C:\Program files\mysql\mysql Connector C 6.0.2


5. Run the Python setup.py install to complete the installation. (Extracted from http://www.linuxfly.org/windows_install_mysql_python_library/)

I encountered the following issues during the compilation process:

1) Problem : _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

cause : The C language Library was not installed when MySQL was installed.

workaround : Re-run the MySQL installer, select Modify, check "C Include files/lib Files" and install.

2) Question : Traceback (most recent):
File "setup.py", line <module>
metadata, Options = Get_config ()
File "c:/mysql-python-1.2.3/setup_windows.py", line 7, in Get_config
Serverkey = _winreg. Openkey (_winreg. HKEY_LOCAL_MACHINE, options[' Registry_key '])
Windowserror: [Error 2] The system cannot find the file specified

reason : MySQL for Python 1.2.3 is still looking for MySQL5.0 version

resolution : 1, open the directory under the Site.cfg file, modify the last behavior "Registry_key = software/mysql ab/mysql Server 5.1"
2. Open the setup_windows.py file and modify the seventh behavior "Serverkey = _winreg. Openkey (_winreg. HKEY_LOCAL_MACHINE, ' Software/mysql ab/mysql Server 5.1 ') "

3) Problem : build/temp.win32-2.7/release/_mysql.pyd.manifest:general error c1010070:failed to load and parse the man Ifest. The system cannot find the file specified.
Error:command ' Mt.exe ' failed with exit status 31

cause : path changed?

workaround : Open the "Your Python installation directory/lib/distutils/msvc9compiler.py" file and locate "Ld_args.append ('/manifestfile: ' + temp_manifest "This line of code, change it to" ld_args.append ('/manifest ') "

(4) When the compilation is complete, you can enter the setup.py install, and now it's done!

You can test by entering the following command in a DOS environment:

C:/users/michael>python
Python 2.6.6 (r266:84297, 18:46:32) [MSC v.1500 + bit (Intel)] on
Win32
Type "Help", "copyright", "credits" or "license" for more information.
>>> Import MySQLdb
>>>

Win64 bit installation python-mysqldb1.2.5

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.