#-*- coding:utf-8 -*- from jpype import * startJVM(getDefaultJVMPath(), "-Djava.class.path=P:\Anaconda3-5.3.1\Anaconda3\envs\py37\Lib\site-packages\pyhanlp\static\hanlp-1.7.8.jar;P:\Anaconda3-5.3.1\Anaconda3\envs\py37\Lib\site-packages\pyhanlp\static", "-Xms1g", "-Xmx1g") # 启动JVM,Linux需替换分号;为冒号: print("=" * 30 + "HanLP分词" + "=" * 30) HanLP = JClass('com.hankcs.hanlp.HanLP') # 中文分词 print(HanLP.segment('你好,欢迎在Python中调用HanLP的API')) print("-" * 70) # # # shutdownJVM()
PyCharm使用pyhanlp失败,只能下面启动
最新推荐文章于 2024-04-23 19:59:09 发布