File "G:\research\code\MicroDE_py\plot_bcic_iv_4_ecog_trial.py", line 262, in
from skorch.helper import predefined_split
File "C:\Users\Lenovo\.conda\envs\braindecode\lib\site-packages\skorch\helper.py", line 6, in
from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (C:\Users\Lenovo\.conda\envs\braindecode\lib\collections\__init__.py)
将报错的代码句子:
from collections import Sequence
修改为:
from collections.abc import Sequence
程序可以成功运行。
Sequence
should be imported from collections.abc
instead of collections
since Python 3.3. A warning is printed starting with Python 3.7 and in Python 3.9 the new import location will be required.
This PR imports from collections.abc
while still falling back to importing from collections
for older Python versions.
翻译:
Sequence
应该从Python 3.3 开始collections.abc
而不是从collections
开始导入。从 Python 3.7 开始打印警告,在 Python 3.9 中将需要新的导入位置。
此 PR 导入自,collections.abc
同时仍回退到从collections
旧 Python 版本导入。
参考:
import Sequence from collections.abc to suppress warning in python 3.… by brian-from-quantrocket · Pull Request #737 · wireservice/agate · GitHub