CARVIEW |
Select Language
HTTP/2 200
date: Sat, 19 Jul 2025 18:43:35 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"74d6f7d13baa1808241e964aaac6f441"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=YXKHizJ7JaJ%2BvqxDPxDQD3MvZE9sN55N8XgJknVLf41PIVQIaSMBT6ZydO4poqI1jgwgj0qjXpTcxNYPHkrVK%2By%2FWlERWtI0O0HPBHWPfWtmOUL%2FZTsVPvZUnBSYL%2F3ywQFpLsSW%2F1jWC5WnOS9YrZDHOSL26yN0ucsDn5VmpPQZtfyUimPdDsR%2FSWmRHI%2BKCO8lIv%2FmfEidKu329lS0FAx9iNJ0Z4ZRxeJhwiNYwXV0hKKWZGUBPxIMa4iZPtvpKTsRbHBp1AIxtZq71QwPvA%3D%3D--8bcdzcmV6m5Oim10--0BMmxNKFHYM5ASr1bnRtDA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1522836401.1752950614; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 18:43:34 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 18:43:34 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 9660:2AF797:22CA7A:2BC5CB:687BE756
Windows · hankcs/pyhanlp Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 803
Windows
hankcs edited this page May 8, 2022
·
8 revisions
pyhanlp完全兼容Windows,依然一句话安装:
pip install pyhanlp
如果安装失败,请根据报错排查:
pyhanlp目前使用jpype1这个Python包来调用HanLP,如果遇到:
building '_jpype' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": https://landinghub.visualstudio.com/visual-cpp-build-tools
则推荐利用轻量级的Miniconda来下载编译好的jpype1。Miniconda是Python语言的开源发行版,提供更方便的包管理。安装时请勾选:
然后执行:
conda install -c conda-forge openjdk python=3.8 jpype1=0.7.0 -y
pip install pyhanlp
请不要将Python安装到c:/program files
,解决方案参考 https://github.com/hankcs/HanLP/issues/1025
未安装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运行环境。
最简单保险的方法是利用conda安装:
conda install -c conda-forge openjdk python=3.8 jpype1=0.7.0 -y
自己安装的话,请下载JDK。你需要保证JDK位数、操作系统位数和Python位数一致。pyhanlp在64位系统上通过了所有测试;在32位系统上可以运行但不做保证。你可能还需要设置JAVA_HOME
环境变量,参考教程。
请注意cygwin内部的路径都是虚拟的,外部JVM访问不到。如果你遇到类似:
raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class
com.hankcs.hanlp.dictionary.CustomDictionary not found
请不要export HANLP_JAR_PATH=/usr/...
,JVM访问不到这个路径;你的路径应该是Windows路径export HANLP_JAR_PATH=C:/...
。同理,hanlp.properties
中的root也必须是Windows路径。
执行hanlp
命令来验证安装。其它子命令也完全支持:
如果发生了本页面没有收录的错误,请提交issue(注明报错信息、操作系统和Python版本),谢谢。
如果你仍然看不懂,也许傻瓜虚拟机更合适你?
Clone this wiki locally
You can’t perform that action at this time.