1、参考:
2、问题:
C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-u617cfx3\jpype1\setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access
FeatureNotice) building '_jpype' extensionerror: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/----------------------------------------
Command "d:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-u617cfx3\\jpype1\\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\ADMINI~1\AppData\Local\Temp\pip-record-v70vznix\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-u617cfx3\jpype1\3、解决方案:
--下载JPype1-0.6.3-cp36-cp36m-win_amd64.whl
--拷贝至:D:\ProgramData\Anaconda3\Scripts
--pip install JPype1-0.6.3-cp36-cp36m-win_amd64.whl
4、测试
5、使用
from pyhanlp import *doc = "XXX"for term in HanLP.segment(doc):print('{}\t{}'.format(term.word, term.nature)) # 获取单词与词性
输出:
D:\ProgramData\Anaconda3\python.exe E:/NLP/Code/hanlpdemo02.pyXXX