问题1.
D:\Anaconda3\lib\site-packages\jpype\_core.py:210: UserWarning:
D:\Java\jdk1.8\jre\bin\server\jvm.dll
-------------------------------------------------------------------------------
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False. The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
-------------------------------------------------------------------------------
""")
解决方案:
pip安装的jpype1-0.7.0,而我的anaconda版本是【Anaconda3-5.0.1-Windows-x86_64】,python版本是【Python 3.6.3 MSC v.1900 64 bit 】,jdk版本是【java 1.8.0_144 64-Bit 】,所以得安装0.7.0以下版本的jpype。当然这个版本的anaconda需要升级numpy 【pip install -U numpy】
pip install jpype1==0.6.3 【报错】
下载【JPype1-0.6.3-cp36-cp36m-win_amd64.whl】
pip install .\JPype1-0.6.3-cp36-cp36m-win_amd64.whl 【成功】
问题2.
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/CustomDictionary.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\CustomDictionary.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/CustomDictionary.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�ִ����ﲹ��ʿ�.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\�ִ����ﲹ��ʿ�.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�ִ����ﲹ��ʿ�.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\ȫ��������ȫ.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\ȫ��������ȫ.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\ȫ��������ȫ.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�����ʵ�.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\�����ʵ�.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�����ʵ�.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�������ʵ�.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\�������ʵ�.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�������ʵ�.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\�Ϻ�����.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\�Ϻ�����.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\�Ϻ�����.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary load
����: �Զ���ʵ�D:\aaaa\hanlp-1.7.3-release\data\dictionary\person\nrf.txt��ȡ����java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\person\nrf.txt (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: ʧ�ܣ�D:\aaaa\hanlp-1.7.3-release\data\dictionary\person\nrf.txt
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: û�м��ص��κδ���
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary loadMainDictionary
����: �Զ���ʵ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/CustomDictionary.txt�����ڣ�java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\custom\CustomDictionary.txt.bin (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CustomDictionary <clinit>
����: �Զ���ʵ�[D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/CustomDictionary.txt, D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�ִ����ﲹ��ʿ�.txt, D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/ȫ��������ȫ.txt ns, D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�����ʵ�.txt, D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�������ʵ�.txt, D:/aaaa/hanlp-1.7.3-release/data/dictionary/custom/�Ϻ�����.txt ns, D:/aaaa/hanlp-1.7.3-release/data/dictionary/person/nrf.txt nrf]����ʧ��
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.corpus.io.IOUtil readBytes
����: ��ȡD:/aaaa/hanlp-1.7.3-release/data/dictionary/CoreNatureDictionary.txt.binʱ�����쳣java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\CoreNatureDictionary.txt.bin (ϵͳ�Ҳ���ָ����·����)
���� 30, 2019 5:38:29 ���� com.hankcs.hanlp.dictionary.CoreDictionary load
����: ���Ĵʵ�D:/aaaa/hanlp-1.7.3-release/data/dictionary/CoreNatureDictionary.txt�����ڣ�java.io.FileNotFoundException: D:\aaaa\hanlp-1.7.3-release\data\dictionary\CoreNatureDictionary.txt (ϵͳ�Ҳ���ָ����·����)
Traceback (most recent call last):
File "E:/PythonSpace/hanlp.py", line 12, in <module>
print(HanLP.segment('你好,欢迎在Python中调用HanLP的API'))
jpype._jexception.ExceptionInInitializerErrorPyRaisable: java.lang.ExceptionInInitializerError
解决方案:
首先确保hanlp.properties,hanlp-1.7.3.jar,data文件在同一目录下(如D:/root/下),打开hanlp.properties,配置【root=D:/root/】