Home>

I am using a library called mojimoji to convert half-width characters to full-width characters.
I want to execute code using this library in Jupyternotebook.

Error message

Here's the Jupyternotebook
When I try to import the library, I get the following error:

import MeCab
import mojimoji
-------------------------------------------------- -------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-c3dcc64cddab>in<module>()
      1 import MeCab
---->2 import mojimoji
ModuleNotFoundError: No module named 'mojimoji'
Applicable source code

When you run the code from the terminal, it will run without problems.

>>>import mojimoji
>>>text = "Nihonko"
>>>text = mojimoji.han_to_zen (text)
>>>print (text)
Japanese
Supplemental information (FW/tool version etc.)

Python 3.6.0 :: Anaconda 4.3.0
Jupyternotebook 5.0.0

  • Answer # 1

    Isn't Python running differently?
    Checksys.prefixandsys.executable.

    import sys
    sys.prefix
    sys.executable


    Does the result match in the interaction environment between Jupyter and the terminal?


    Terminal dialogue environment,

    import mojimoji
    mojimoji .__ file __


    Where do the files appear after running
    (sys.prefix directory) /lib/pyhton3.6/site-packages/mojimoji. ??????. Soin the terminal's interactive environment?


    Isn't you running jupyter notebook from the terminal to launch Jupyter Notebook and using another method (Launchpad?)?

    The conclusion is that anaconda installed from pyenv and anaconda installed by anaconda installer coexist.

    The Jupyter Notebook you're looking at is from the anaconda installer.
    The terminal starts pyenv's anaconda, so mojimoji also entered pyenv's anaconda.
    It is not possible to use from Jupyter Notebook because there is a conflict.

    If you have installed with the anaconda installer, you should just use the pyenv to erase it.
    You can start Jupyter Notebook from the terminal withjupyter notebook.