mirror of
https://github.com/open-mmlab/mmcv.git
synced 2025-06-03 21:54:52 +08:00
[Fix] Get correct encoding in Windows for collect_env() (#1887)
* [Fix] get correct encoding in Windows for collect_env() * stdout.fileno()
This commit is contained in:
parent
b80447707c
commit
a5cfcb93ff
@ -81,13 +81,13 @@ def collect_env():
|
||||
# on Windows, cl.exe is not in PATH. We need to find the path.
|
||||
# distutils.ccompiler.new_compiler() returns a msvccompiler
|
||||
# object and after initialization, path to cl.exe is found.
|
||||
import locale
|
||||
import os
|
||||
from distutils.ccompiler import new_compiler
|
||||
ccompiler = new_compiler()
|
||||
ccompiler.initialize()
|
||||
cc = subprocess.check_output(
|
||||
f'{ccompiler.cc}', stderr=subprocess.STDOUT, shell=True)
|
||||
encoding = locale.getdefaultlocale()[1]
|
||||
encoding = os.device_encoding(sys.stdout.fileno()) or 'utf-8'
|
||||
env_info['MSVC'] = cc.decode(encoding).partition('\n')[0].strip()
|
||||
env_info['GCC'] = 'n/a'
|
||||
except subprocess.CalledProcessError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user