Ubuntu 20.04 LTS pyenv 1.2.8 Python 3.7.3 CaboCha 0.60
$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda custom (64-bit) on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import CaboCha
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/Jittsu/cabocha-0.60/python/CaboCha.py", line 15, in <module>
import _CaboCha
ModuleNotFoundError: No module named '_CaboCha'
I have CaboCha installed and can use it from the command line, but I can't use it from Python.
If you are using pyenv and execute the following command, the python path is different from the one used, so ModuleNotFoundError occurs.
$ sudo python3 setup.py build_ext
$ sudo python3 setup.py install
$ sudo /sbin/ldconfig
Instead, run the following command.
$ sudo $(which python) setup.py build_ext
$ sudo $(which python) setup.py install
$ sudo /sbin/ldconfig
$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda custom (64-bit) on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import CaboCha
>>>
You can now use it.
https://teratail.com/questions/190826
Recommended Posts