3

(I'm not sure if this should be asked here or SU.. but seeing this question on SO, I am asking it here...)

I have wamp (mysql-5.1.33) server setup on my vista machine, and I am trying to install python-mysql 1.2.3c1 to use the mysql version provided by wamp.

At first, when I ran python setup.py install, I got an error saying it couldn't find the location of the mysql's bin folder. Looking into setup_windows.py, I noticed it was looking for a registry key and so I added that registry entry and I think it is able to find it now.

But now, when I run python setup.py install, I get a different error saying Unable to find vcvarsall.bat.

Any help on installing this appreciated.

Here is the output of python setup.py install:

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
running build_py
copying MySQLdb\release.py -> build\lib.win32-2.6\MySQLdb
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat

Thanks a lot!

Community
  • 1
  • 1
sharat87
  • 7,330
  • 12
  • 55
  • 80

3 Answers3

1

The reason is msvc9compiler.py in Python26\Lib\distutils don't analyse VC version properly. You can check find_vcvarsall(version) in msvc9compiler.py yourself: it always turns version = 9, means VC9(2008) will work, but never VC8(2005). The awkward way to compile something using setup.py with VC8 is make version = 8 manually in the function above, after build and install recover it to old.

  • wow, thanks for the update. Weird way to set the version to always return 9, but I guess there is a really good reason to do so that I am not aware of. Thanks again, really good to know. – sharat87 Jan 03 '11 at 05:13
0

It is looking for the Microsoft Visual Studio compiler to take care of some (presumably) C libraries.

You need to install Visual Studio, or perhaps MINGW.

Oddthinking
  • 24,359
  • 19
  • 83
  • 121
  • Thanks, I already have gcc through cygwin.. so how do I use it? – sharat87 Oct 17 '09 at 07:45
  • Sorry, I don't know. Perhaps that would make another good SO question? – Oddthinking Oct 17 '09 at 14:25
  • my problem is where do I find that `vcvarsall.bat`, even if I do have Visual Studio compiler.. I think that's the whole point of this question... even if I do ask another question, i think it will seem quite identical to this one.. – sharat87 Oct 18 '09 at 05:09
  • I'm sorry, I can't be as helpful as I would like here. My recollection from many years ago, was that vcvarsall.bat was provided by Visual Studio. It was placed in the path, so it could be found by build scripts such as this. It set-up some environment variables pointing to the compiler, linker etc, so the build script could call them as required. I have never used the MINGW/Cygwin C-compilers, so I don't know if they provide a similar trick. I wonder if new question titled "How do I build Python libraries with Cygwin, Not Visual Studio?" would attract more attention. – Oddthinking Oct 19 '09 at 10:06
0

You can use a precompiled binary available at sourceforge page of mysql-python. The version 1.2.2 has the binary installer for python2.4 and python2.5

If you are searching for python2.6 binaries, find it here - http://www.codegood.com/archives/4

Awin
  • 884
  • 7
  • 9