Skip to content

Windows

hankcs edited this page Apr 7, 2018 · 8 revisions

Windows安装pyhanlp指南

pyhanlp完全兼容Windows,依然一句话安装:

pip install pyhanlp

如果安装失败,请根据报错排查:

Java

未安装Java时会报错:

jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) foun
d. Try setting up the JAVA_HOME environment variable properly.

HanLP主项目采用Java开发,所以需要Java运行环境,请安装JDK

jpype1

pyhanlp目前使用jpype1这个Python包来调用HanLP,如果遇到:

building '_jpype' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

则推荐利用轻量级的Miniconda来下载编译好的jpype1。Miniconda是Python语言的开源发行版,提供更方便的包管理。安装时请勾选:

conda

然后执行:

conda install -c conda-forge jpype1
pip install pyhanlp

测试安装

执行hanlp命令来验证安装。其它子命令也完全支持:

cmd

如果发生了本页面没有收录的错误,请提交issue(注明报错信息、操作系统和Python版本),谢谢。

Clone this wiki locally