https://github.com/famousdraw

如何安装中文分词工具

在使用jieba中文分词工具时,报错如下:

import jieba
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-41-71874e60dc26> in <module>
----> 1 import jieba

ModuleNotFoundError: No module named 'jieba'

 

原来是没有安装jieba的库,以下为安装方法。

(base) JasondeMacBook-Air:~ jason_zhao$ pip install jieba
Collecting jieba
Downloading jieba-0.42.1.tar.gz (19.2 MB)
|████████████████████████████████| 19.2 MB 319 kB/s
Building wheels for collected packages: jieba
Building wheel for jieba (setup.py) ... done
Created wheel for jieba: filename=jieba-0.42.1-py3-none-any.whl size=19314478 sha256=f3393d193e9b386cf38fb6045b35a9328225df6eb4b9748cde7346dbf0e3fe30
Stored in directory: /Users/jason_zhao/Library/Caches/pip/wheels/ca/38/d8/dfdfe73bec1d12026b30cb7ce8da650f3f0ea2cf155ea018ae
Successfully built jieba
Installing collected packages: jieba
Successfully installed jieba-0.42.1

posted on 2021-06-23 17:08  红色MINI  阅读(250)  评论(0编辑  收藏  举报

导航