DEBUG – Mac發生JPypeClassLoader問題解決

0
43
Traceback (most recent call last):
  File "/Users/johnny/Documents/virtualenv/Work/bin/hanlp", line 11, in <module>
    load_entry_point('pyhanlp==0.1.49', 'console_scripts', 'hanlp')()
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/pyhanlp/__init__.py", line 122, in <module>
    _start_jvm_for_hanlp()
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/pyhanlp/__init__.py", line 119, in _start_jvm_for_hanlp
    HANLP_JVM_XMX, convertStrings=True)
  File "/Users/johnny/Documents/virtualenv/Work/lib/python3.7/site-packages/jpype/_core.py", line 219, in startJVM
    _jpype.startup(jvmpath, tuple(args), ignoreUnrecognized, convertStrings)
jpype._jclass.UnsupportedClassVersionError: org/jpype/classloader/JPypeClassLoader : Unsupported major.minor version 52.0

Mac使用jpype時有時候會發生這種JPypeClassLoader錯誤,通常這是Java版本太舊問題,Mac吃到了舊版的Java,通常出現在python3.6、3.7。

我是在操作pyhanlp的時候發生這個錯誤。

只要到Java安裝地址把舊版的Java移除即可。

如下圖移除1.6.0.jdk,保留較新版jdk就不會出現錯誤了。

Leave a Reply

avatar
  Subscribe  
Notify of