Installing MySQL Python Package on Windows

I work in *nix environment but sometimes you may want to test some features on your own Windows desktop either due to access constraints on test or development systems. For example, company not allowing to install the latest packages or non-standard tools or you may be lazy and have setup your own little world on a desktop to do your tests, etc.  Anyway, I needed to install Python MySQL package and installing that package is not as straight forward as installing it on Linux systems.

> python setup.py install

The above one typically takes care of it in *nix environment. But in windows you may see following error
“Unable to find vcvarsall.bat” and if so you should download and install Microsoft Visual C++ Express Edition.  Installing whole Visual SDK kit seem like like a overkill for getting one .BAT file.

Now to install MySQL Python package, download it from sourceforge , gunzip it, untar it and make the following change before running install.

Change registry_key entry in site.cfg file to the entry in Windows registry of MySQL (SOFTWARE\MySQL AB\MySQL Server X.X) where X.X is MySQL Server installed.  Open the Windows regedit and check for the entry (and as always backup the registry first).

Now run

> python setup.py install

and during the installation you should see something like this:

running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info\PKG-INFO
writing top-level names to MySQL_python.egg-info\top_level.txt
writing dependency_links to MySQL_python.egg-info\dependency_links.txt
reading manifest file ‘MySQL_python.egg-info\SOURCES.txt’
reading manifest template ‘MANIFEST.in’
writing manifest file ‘MySQL_python.egg-info\SOURCES.txt’
installing library code to build\bdist.win32\egg
running install_lib


Processing MySQL_python-1.2.3c1-py2.6-win32.egg
Copying MySQL_python-1.2.3c1-py2.6-win32.egg to c:\python26\lib\site-packages
Adding MySQL-python 1.2.3c1 to easy-install.pth file
Installed c:\python26\lib\site-packages\mysql_python-1.2.3c1-py2.6-win32.egg
Processing dependencies for MySQL-python==1.2.3c1
Finished processing dependencies for MySQL-python==1.2.3c1

Change directory to tests sub-directory and run

> python test_MySQLdb_capabilities.py

HTH,
Shiva

One thought on “Installing MySQL Python Package on Windows

  1. Chúng tôi chuyên nhận vận chuyển hàng hóa nội địa hiện nay. Chúng tôi xin giới thiệu với bạn các dịch vụ vận chuyển, giao hàng uy tín để phục vụ nhu cầu Tết của quý khách hàng. Cụ thể chúng tôi sẽ cung cấp dịch vụ vận chuyển gửi quà tết. Chúng tôi sẽ giúp bạn vận chuyển hàng hóa đến tay người thân, bạn bè ở xa một cách nhanh chóng nhất. Đảm bảo giá cả hợp lý chất lượng dịch vụ tuyệt vời. Ngoài ra chúng tôi còn cung cấp nhiều dịch vụ khác như dịch vụ ship hàng cod, giao hàng cho shop, dịch vụ chuyển phát nhanh uy tín,… Nếu cần chuyển hàng hãy nhớ liên hệ với chúng tôi nhé.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s