Skip to content

Commit 5e96c57

Browse files
authored
Revert "get library extension suffix from built-in method (#1036)" (#1072)
This reverts commit f35afe0.
1 parent 9dcc816 commit 5e96c57

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

deepmd/env.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44
import os
5-
import distutils.ccompiler
5+
import platform
66
from configparser import ConfigParser
77
from imp import reload
88
from pathlib import Path
@@ -157,8 +157,12 @@ def get_module(module_name: str) -> "ModuleType":
157157
FileNotFoundError
158158
if module is not found in directory
159159
"""
160-
# https://discuss.python.org/t/how-to-get-the-file-extension-of-dynamic-libraries-for-current-os/3916/5
161-
ext = distutils.ccompiler.new_compiler().shared_lib_extension
160+
if platform.system() == "Windows":
161+
ext = ".dll"
162+
elif platform.system() == "Darwin":
163+
ext = ".dylib"
164+
else:
165+
ext = ".so"
162166

163167
module_file = (
164168
(Path(__file__).parent / SHARED_LIB_MODULE / module_name)

0 commit comments

Comments
 (0)