diff --git a/hanlp/utils/io_util.py b/hanlp/utils/io_util.py index ea87c671c..da0609f68 100644 --- a/hanlp/utils/io_util.py +++ b/hanlp/utils/io_util.py @@ -25,7 +25,7 @@ from hanlp_downloader import Downloader from hanlp_downloader.log import DownloadCallback -from pkg_resources import parse_version +from packaging.version import Version import hanlp from hanlp_common.constant import HANLP_URL, HANLP_VERBOSE @@ -688,7 +688,7 @@ def check_outdated(package='hanlp', version=__version__, repository_url='https:/ Returns: Parsed installed version and latest version. """ - installed_version = parse_version(version) + installed_version = Version(version) latest_version = get_latest_info_from_pypi(package, repository_url) return installed_version, latest_version @@ -696,7 +696,7 @@ def check_outdated(package='hanlp', version=__version__, repository_url='https:/ def get_latest_info_from_pypi(package='hanlp', repository_url='https://pypi.python.org/pypi/%s/json'): url = repository_url % package response = urllib.request.urlopen(url).read() - return parse_version(json.loads(response)['info']['version']) + return Version(json.loads(response)['info']['version']) def check_version_conflicts(extras=None):