In order to use CaboCha with Python, I was proceeding with reference to "CaboCha & Python3 environment construction (Windows version)", but (4) I got stuck at the last setup.py of, so a memorandum of the solution
The quote source said to modify the source code of setup.py, but it didn't work for me. So, I modified setup.py by referring to the article "Windows 10-64bit using CaboCha with Python" and it worked. The following amendments that do not work and amendments that work
Proposed amendment that didn't work
#!/usr/bin/env python
from distutils.core import setup,Extension,os
import string
def cmd1(str):
return os.popen(str).readlines()[0][:-1]
def cmd2(str):
return cmd1(str).split()
setup(name = "cabocha-python",
#↓ Fix as below version= cmd1("cabocha-config --version"),
py_modules=["CaboCha"],
ext_modules = [
Extension("_CaboCha",
["CaboCha_wrap.cxx",],
include_dirs=[r"C:\Program Files (x86)\CaboCha\sdk"],
library_dirs=[r"C:\Program Files (x86)\CaboCha\sdk"],
libraries=cmd2("cabocha-config --libs-only-l"))
])
Successful fix
#!/usr/bin/env python
from distutils.core import setup,Extension,os
import string
def cmd1(str):
return os.popen(str).readlines()[0][:-1]
def cmd2(str):
return cmd1(str).split()
setup(name = "cabocha-python",
version = "0.69",
py_modules=["CaboCha"],
ext_modules = [
Extension("_CaboCha",
["CaboCha_wrap.cxx",],
include_dirs=[r"C:\Program Files (x86)\CaboCha\sdk"],
library_dirs=[r"C:\Program Files (x86)\CaboCha\sdk"],
##↓ Correct this part
libraries=['libcabocha'])
])
Recommended Posts