0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CaboChaをpython3で使えるようにする時つまったところ(Windows10)

Last updated at Posted at 2020-05-02

CaboChaをPythonで使えるようにするために「CaboCha & Python3の環境構築(Windows版)」を参考に進めていたが,(4)の最後のsetup.pyのところでつまったので解決方法の備忘録

引用元だとsetup.pyのソースコードを修正するように書いてあったが,自分の場合はうまくいかなかった.
そこで「CaboChaをPythonで使う Windows10-64bit」の記事を参考にsetup.pyを修正するとうまくいった.
以下うまくいかない修正案とうまくいった修正案

うまくいかなかった修正案
#!/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 = 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"))
            ])
うまくいった修正案
#!/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"],
            ##↓ここの部分を修正
            libraries=['libcabocha'])
])
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?