pip install pyhanlp
安装失败的话可以去https://github.com/hankcs/pyhanlp下载pyhanlp-master.zip,然后用一下命令安装:
pip install pyhanlp-master.zip
问题1:import pyhanlp时报错:FileNotFoundError:[Errno 2] No such file or director:‘D:\proframData\Anaconda2\envs\py3\lib\site-package\pyhanlp\static\hanlp-1.7.4-release.zip’
解决方法:下载hanlp-1.7.4-release.zip,放到…/lib/site-package\pyhanlp\static文件夹下,在执行import pyhanlp,此文件夹下会多出一个hanlp-1.7.4.jar文件。
下载hanlp-1.7.4-release.zip会遇到资源不好下载不下来的问题,https://download.csdn.net/download/ljzology/11718564有下载好的。
问题2:ValueError:配置错误:数据包 D:/programData/Anacoda2/envs/py36/lib/site-packages/pyhanlp/static\data 不存在,请修改配置文件中的root
处理方法:
下载data.zip(http://nlp.hankcs.com/download.php?file=data),解压后放到/site-packages/pyhanlp/static下
注:复制自博客https://blog.csdn.net/ljzology/article/details/100736302