windowsでpython2.5でvc++2010でmecab0.994を使う
以下の環境
mecab本体は、公式のバイナリをインストール。
pythonバインディングをビルドする時に、トラブル。
python setup.py buildで以下のエラーが出る。
running build running build_py running build_ext error: Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing "-c mingw32" to setup.py.
を参考に、'Python25\Lib\distutils\msvccompiler.py'を書き換えてみても同じ。
これは、distutils + Visual Studio による拡張モジュールビルド時のメモ - muddy brown thangを見て分かったけど、無駄に.NETFRAMEWORKを見に行ってるだけっぽい。
だから'msvccompiler.py'の126行目付近からの、その該当部分を、ごっそりコメントアウト。
# try: # if version > 7.0: # self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") # else: # self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") # if version >= 8: # self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv2.0") # elif version > 7.0: # self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") # except KeyError, exc: # # raise DistutilsPlatformError, \ # ("""Python was built with Visual Studio 2003; #extensions must be built with a compiler than can generate compatible binaries. #Visual Studio 2003 was not found on this system. If you have Cygwin installed, #you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""")
これでビルドできて、test.pyが無事に動いた。
そのうちなんか副作用が出てくるかもしれないのでメモ。