安裝python版的hanlp時老是出錯,直接 pip install pyhanlp,會出現這個錯誤:
In file included from native/common/jp_method.cpp:17: native/common/include/jpype.h:56:10: fatal error: 'map' file not found #include <map> ^~~~~ 1 warning and 1 error generated. error: command 'gcc' failed with exit status 1
最后的解決辦法是參考:
先用conda安裝gcc:
conda install gcc
再用conda安裝jpype1:
conda install -c conda-forge jpype1
最后終於可以直接安裝pyhanlp了
pip install pyhanlp
搞定
在python里驗證一下:
from pyhanlp import *
然后會自動下載相關的庫