报错如下:

 File "E:\anaconda3\envs\pytorch\lib\pathlib.py", line 988, in __new__
    raise NotImplementedError("cannot instantiate %r on your system"
NotImplementedError: cannot instantiate 'PosixPath' on your system

如果尝试修改pathlib.py文件会形成如下新的调用循环的错误:

 File "E:\anaconda3\envs\pytorch\lib\pathlib.py", line 16, in <module>
    temp = pathlib.PosixPath
AttributeError: partially initialized module 'pathlib' has no attribute 'PosixPath' (most likely due to a circular import). Did you mean: 'posixpath'?

解决办法:在moudels.py/general.py文件的开头加入如下代码

import pathlib
temp = pathlib.PosixPath
pathlib.PosixPath = pathlib.WindowsPath

就可以啦~

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐