问题描述
之前在Linux环境下训练好了模型,后使用Windows系统加载模型使用报错
解决办法
修改所使用环境下的lib/pathlib.py代码大概1040行的函数:
def __new__(cls, *args, **kwargs):
if cls is Path:
cls = WindowsPath if os.name == 'nt' else PosixPath
self = cls._from_parts(args, init=False)
if not self._flavour.is_supported:
raise NotImplementedError("cannot instantiate %r on your system"
% (cls.__name__,))
self._init()
return self
def __new__(cls, *args, **kwargs):
if cls is Path:
cls = WindowsPath
self = cls._from_parts(args, init=False)
if type(self) == PosixPath:
cls = WindowsPath
self = cls._from_parts(args, init=False)
if not self._flavour.is_supported:
raise NotImplementedError("cannot instantiate %r on your system"
% (cls.__name__,))
self._init()
return self
|