From 7dc16f7af7626176c0dab883d259fb085b933e38 Mon Sep 17 00:00:00 2001 From: "sam.sun" Date: Thu, 26 Sep 2024 19:39:07 +0800 Subject: [PATCH 1/2] update jpype version --- requirements.txt | 2 +- setup.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8fb36dc..347f544 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ absl-py==0.1.10 -jpype1==0.7.0 +jpype1==1.5.0 diff --git a/setup.py b/setup.py index 0c8fad2..8e5ee23 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def browser_open(url='https://nlp.hankcs.com/download.php?file=install'): pass -JPYPE = 'jpype1==0.7.0' +JPYPE = 'jpype1==1.5.0' try: import subprocess @@ -27,8 +27,8 @@ def browser_open(url='https://nlp.hankcs.com/download.php?file=install'): except: browser_open() errors = ['{} 安装失败'.format(JPYPE)] - if sys.version_info >= (3, 9): - errors.append('暂不支持 Python 3.9 及以上版本') + if sys.version_info >= (3, 11): + errors.append('暂不支持 Python 3.11 及以上版本') sys.exit( ''' ---------------------------------------- From 6adb812c846ecb400597848e549b310378220ebb Mon Sep 17 00:00:00 2001 From: "sam.sun" Date: Fri, 27 Sep 2024 10:29:49 +0800 Subject: [PATCH 2/2] update __init__.py --- pyhanlp/__init__.py | 4 ++-- requirements.txt | 2 +- setup.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyhanlp/__init__.py b/pyhanlp/__init__.py index 57146e3..a295669 100644 --- a/pyhanlp/__init__.py +++ b/pyhanlp/__init__.py @@ -153,8 +153,8 @@ def _attach_jvm_to_thread(): """ use attachThreadToJVM to fix multi-thread issues: https://github.com/hankcs/pyhanlp/issues/7 """ - if not isThreadAttachedToJVM(): - attachThreadToJVM() + if not java.lang.Thread.isAttached(): + java.lang.Thread.attach() class SafeJClass(object): diff --git a/requirements.txt b/requirements.txt index 347f544..8e346cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -absl-py==0.1.10 +absl-py==2.1.0 jpype1==1.5.0 diff --git a/setup.py b/setup.py index 8e5ee23..5fcb68a 100644 --- a/setup.py +++ b/setup.py @@ -27,8 +27,8 @@ def browser_open(url='https://nlp.hankcs.com/download.php?file=install'): except: browser_open() errors = ['{} 安装失败'.format(JPYPE)] - if sys.version_info >= (3, 11): - errors.append('暂不支持 Python 3.11 及以上版本') + if sys.version_info >= (3, 13): + errors.append('暂不支持 Python 3.13 及以上版本') sys.exit( ''' ----------------------------------------