jupyterでMeCabをインストールできません
始めて質問します。jupyter notebookでMeCabが使えなくて困っております。
<実行コード>
!pip install mecab-python3
でインストールしようとすると以下のエラーが出ます。
<エラー内容>
Building wheel for mecab-python3 (setup.py): finished with status 'error'
Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/6b/9d/38d24176cb9f38c5c48c3ed837e3102a738fe197b05c31e6d2ba534dcd86/mecab-python3-0.996.2.tar.gz
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py): started
Building wheel for mecab-python3 (setup.py): finished with status 'error'
Running setup.py clean for mecab-python3
Failed to build mecab-python3
Installing collected packages: mecab-python3
Running setup.py install for mecab-python3: started
Running setup.py install for mecab-python3: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
ERROR: Complete output from command 'C:\Users\SF\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\SF\AppData\Local\Temp\pip-install-3lhjn75r\mecab-python3\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\SF\AppData\Local\Temp\pip-wheel-ohhnng7p' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MeCab
copying src\MeCab_init_.py -> build\lib.win-amd64-3.7\MeCab
running build_ext
error: [WinError 2] 指定されたファイルが見つかりません。
ERROR: Failed building wheel for mecab-python3
ERROR: Complete output from command 'C:\Users\SF\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\SF\AppData\Local\Temp\pip-install-3lhjn75r\mecab-python3\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\SF\AppData\Local\Temp\pip-record-6n9ybdc0\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MeCab
copying src\MeCab_init_.py -> build\lib.win-amd64-3.7\MeCab
running build_ext
error: [WinError 2] 指定されたファイルが見つかりません。
ERROR: Command "'C:\Users\SF\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\SF\AppData\Local\Temp\pip-install-3lhjn75r\mecab-python3\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\SF\AppData\Local\Temp\pip-record-6n9ybdc0\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SF\AppData\Local\Temp\pip-install-3lhjn75r\mecab-python3\
試したこと
コマンドプロンプトで、pythonからimport MeCabで文字の変換はできます。
補足情報(FW/ツールのバージョンなど)
環境は、
windows10 64bit
Python 3.7.3
pip 19.1.1
The version of the notebook server is: 5.7.8
になります。
juputerから以下を実行すると
import MeCab
tagger = MeCab.Tagger()
result = tagger.parse("メイが恋ダンスを踊っている")
print(result)
を実行すると、以下のエラーが出ます。
<エラー内容>
Exception in callback BaseAsyncIOLoop._handle_events(1180, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(1180, 1)>
Traceback (most recent call last):
File "C:\Users\SF\Anaconda3\lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\SF\Anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 138, in _handle_events
handler_func(fileobj, events)
File "C:\Users\SF\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 456, in _handle_events
self._handle_recv()
File "C:\Users\SF\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 486, in _handle_recv
self._run_callback(callback, msg)
File "C:\Users\SF\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 438, in _run_callback
callback(*args, **kwargs)
File "C:\Users\SF\Anaconda3\lib\site-packages\ipykernel\iostream.py", line 120, in _handle_event
event_f()
File "C:\Users\SF\Anaconda3\lib\site-packages\ipykernel\iostream.py", line 380, in _flush
parent=self.parent_header, ident=self.topic)
File "C:\Users\SF\Anaconda3\lib\site-packages\jupyter_client\session.py", line 737, in send
to_send = self.serialize(msg, ident)
File "C:\Users\SF\Anaconda3\lib\site-packages\jupyter_client\session.py", line 625, in serialize
content = self.pack(content)
File "C:\Users\SF\Anaconda3\lib\site-packages\jupyter_client\session.py", line 103, in <lambda>
ensure_ascii=False, allow_nan=False,
File "C:\Users\SF\Anaconda3\lib\site-packages\zmq\utils\jsonapi.py", line 43, in dumps
s = s.encode('utf8')
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 25-26: surrogates not allowed
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。