PYTHON-MYSQLDB Installation problems and workarounds

Source: Internet
Author: User

Currently downloaded MYSQLDB under window does not have EXE installation package, only the source code.

Install with the Python setup.py install command,

The error is as follows:

The exception information is as follows:

f:\devtools\mysql-python-1.2.3>pythonsetup.py Build

Traceback (most recent):

File "setup.py", line <module>

metadata, Options = Get_config ()

File "F:\devtools\MySQL-python-1.2.3\setup_windows.py", Line7, in Get_config

Serverkey = _winreg. Openkey (_winreg. HKEY_LOCAL_MACHINE, options[' Registry_ke

Y '])

Windowserror: [Error 2] The system cannotfind the file specified

Workaround:

In fact, the analysis of the code, found just looking for MySQL installation address only modified setup_windows.py as follows

Note Two lines, add a line, for the first step MySQL installation location

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

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

Mysql_root = r "F:\devtools\MySQL\MySQL Server 5.5"

When you are finished, install again,

The error is as follows

unable to find Vcvarsall.bat error

The first type:

First install the MinGW;
Add the MinGW path to the environment variable path, such as MinGW installed in D:\MinGW\, add D:\MinGW\bin to path;
Open a command-line window and enter the directory where you want to install the code in the command-line window;
Enter the following command to install it. setup.py Install build--compiler=mingw32

The second type:

Today in the installation of the PYSCOPG2 Library when the unable to find Vcvarsall.bat error, on the internet for a while, some people say is to install MinGW to solve, I tried, but can not later find another solution:
1, to http://www.microsoft.com/express/Downloads/#2008-visual-cpp to download Visual C + + Express Edition
2, then install, and then re-python setup.py install.
This should be a common method, if you install other libraries when you encounter unable to find Vcvarsall.bat error, you should also be able to solve
Note: Do not download 2010, I do not know why, anyway, people say it seems to be 2010 No
Also: If you encounter mc.exe error when installing, then you need to add C:\Program Files\Microsoft Sdks\windows\v7.0a\bin to your PATH variable

The first is to use MinGW to compile this Python package with C, the second is VC inside the Vcvarsall.bat script, but these two methods are more troublesome, and to download so big things installed,

The first method was tested, no,

The second software is too big to download, there is no test.

Then directly on the network to find Mysqldb-python EXE file, directly installed on it. Save a lot of trouble.

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.