0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[ifs] no such file or directory: /usr/local/etc/mecabrc の解決方法

Posted at

状況

OS:windows 11 pro
dockerイメージ:nvcr.io/nvidia/pytorch:23-04-py3
dockerのコンテナ上でMecabを使用して、自然言語処理を行っていたところ以下のエラーが発生

[ifs] no such file or directory: /usr/local/etc/mecabrc

以下のように環境変数にmecabrcのパスを通しても治らない

export MECABRC="[インストール先]/etc/mecabrc"

解決策

MeCab.Taggerの中でmecabrcファイルを指定してあげるとうまくいく。

tagger = MeCab.Tagger(r'-r /etc/mecabrc -d /usr/share/mecab/dic/mecab-ipadic-neologd')

mecabrcファイルの探し方は以下のコマンド

find / -iname mecabrc
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?