浏览代码

fix get gcc version error, there is not gcc on windows

gaotingquan 10 月之前
父节点
当前提交
3479205bad
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      paddlex/repo_manager/utils.py

+ 4 - 4
paddlex/repo_manager/utils.py

@@ -103,16 +103,16 @@ def install_packages_using_pip(
 
 def install_external_deps(repo_name, repo_root):
     """install paddle repository custom dependencies"""
-    gcc_version = (
-        subprocess.check_output(["gcc", "--version"]).decode("utf-8").split()[2]
-    )
+
+    def get_gcc_version():
+        return subprocess.check_output(["gcc", "--version"]).decode("utf-8").split()[2]
 
     if repo_name == "PaddleDetection":
         if os.path.exists(os.path.join(repo_root, "ppdet", "ext_op")):
             """Install custom op for rotated object detection"""
             if (
                 PLATFORM == "Linux"
-                and _compare_version(gcc_version, "8.2.0") >= 0
+                and _compare_version(get_gcc_version(), "8.2.0") >= 0
                 and "gpu" in get_device_type()
                 and (
                     paddle.is_compiled_with_cuda()