From bda59b1bfe3abd103761a3e5898ad44baafab881 Mon Sep 17 00:00:00 2001 From: YUNSHEN XIE <1084314248@qq.com> Date: Fri, 24 Feb 2023 14:21:48 +0800 Subject: [PATCH] fix setup.py (#50800) --- setup.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 819488ababd..275fe3b6bc9 100644 --- a/setup.py +++ b/setup.py @@ -43,10 +43,17 @@ else: python_version = platform.python_version() os.environ["PY_VERSION"] = python_version else: - if os.getenv("PY_VERSION") != platform.python_version()[:3]: + if os.getenv("PY_VERSION") != str(sys.version_info.major) + '.' + str( + sys.version_info.minor + ): raise RuntimeError( "You set PY_VERSION=%s, but your current python environment is %s, you should keep them consistent!" - % (os.getenv("PY_VERSION"), platform.python_version()[:3]) + % ( + os.getenv("PY_VERSION"), + str(sys.version_info.major) + + '.' + + str(sys.version_info.minor), + ) ) # check cmake -- GitLab