LoginSignup
3
3

More than 5 years have passed since last update.

travisでpython-mecabを動かしたい時の設定

Posted at

Pythonで形態素解析をしたい時、とりあえずMeCabを使うときがある。ただこのMeCab、pip install MeCab みたいに1行書けばすぐに使える楽な物では無いので、他の環境で動かしたい時にやや面倒。何度か試行錯誤したのでメモ。

方針

  • Virtualenvを使う
  • システムに apt-get install python-mecab で入れた物を使わない

設定

システムにインストールするmecabは全てバージョンを指定する。

.travis.yml
before_install:
  - sudo apt-get update -qq
  - wget http://ftp.sjtu.edu.cn/ubuntu/pool/universe/m/mecab/libmecab2_0.996-1.1_amd64.deb
  - sudo dpkg -i  libmecab2_0.996-1.1_amd64.deb
  - wget http://ftp.sjtu.edu.cn/ubuntu/pool/universe/m/mecab/libmecab-dev_0.996-1.1_amd64.deb
  - sudo dpkg -i libmecab-dev_0.996-1.1_amd64.deb
  - wget http://ftp.sjtu.edu.cn/ubuntu/pool/universe/m/mecab/mecab-utils_0.996-1.1_amd64.deb
  - sudo dpkg -i mecab-utils_0.996-1.1_amd64.deb
  - sudo apt-get install -y mecab-ipadic-utf8
language: python
python:
  - "2.7"
install:
  - "pip install -r requirements.txt"
script: "python tests.py"
requirements.txt
https://mecab.googlecode.com/files/mecab-python-0.996.tar.gz

結果

動いた
https://travis-ci.org/hagino3000/mecab-deploy-test

3
3
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
3
3