He is a troubled uncle who is added to the Advent calendar and never writes without knowing it. .. ..
I'm working in a corporate server environment for joint research. I didn't get sudo privileges ... I want to use mecab, but I'm sorry I didn't install it. Basically, I just specify the user directory for --prefix ... It's just a memorandum
Put compressed files of python2. *. *, Mecab, ipadic, mecab-python in ~ / temp (directory name can be anything)
tar xvf Python-2.*.*.tgz
cd Python2.*.*
./configure --prefix=/home/user-name/usr/local
make
make install
tar xvf mecab-0.996.tar.gz
cd mecab-0.996
./configure --prefix=$HOME/usr/local --with-charset=utf8 --enable-utf8-only
make
make install
.*shrc
export PATH=/home/user-name/usr/local/bin:$PATH
tar xvzf mecab-ipadic-2.7.0-********.tar.gz
cd mecab-ipadic-2.7.0-*********
./configure --with-charset=utf8 --with-dicdir=~/local/mecab-dic/ipadic-utf8
make
make install
Change / home / user-name / usr / local / etc / mecabrc
mecabrc
.
.
dicdir = /home/user-name/local/mecab-dic/ipadic-utf8
.
.
tar xvzf mecab-python-0.996.tar.gz
cd mecab-python-0.996
vim setup.py(The edited contents are as ↓)
python setup.py build
python setup.py install
Rewrite all directory paths described in setup.py
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 string.split (cmd1(str))
setup(name = "mecab-python",
version = cmd1("/home/user-name/temp/mecab-0.996/mecab-config --version"),
py_modules=["MeCab"],
ext_modules = [
Extension("_MeCab",
["MeCab_wrap.cxx",],
include_dirs=cmd2("/home/user-name/temp/mecab-0.996/mecab-config --inc-dir"),
library_dirs=cmd2("/home/user-name/temp/mecab-0.996/mecab-config --libs-only-L"),
libraries=cmd2("/home/user-name/temp/mecab-0.996/mecab-config --libs-only-l"))
])
Finally pass the pass
.*shrc
.
.
export PATH=/home/user-name/usr/local/lib:$PATH
export LD_LIBRARY_PATH=/home/user-name/usr/local/lib
.
.
reference: http://qiita.com/saicologic/items/ab70e14f7e2ec2ee0b4d http://oshiete.goo.ne.jp/qa/8883975.html
Recommended Posts