Python运行报错:ImportError: cannot import name 'BinarySpaceToDiscreteSpaceEnv' from 'nes_py.wrappers'

Angry Panda / 2024-08-05 / 原文

运行Python项目:

https://pypi.org/project/gym-super-mario-bros/

报错:

ImportError: cannot import name 'BinarySpaceToDiscreteSpaceEnv' from 'nes_py.wrappers'



image



解决方法:

from nes_py.wrappers import BinarySpaceToDiscreteSpaceEnv

替换为:

from nes_py.wrappers import JoypadSpace as BinarySpaceToDiscreteSpaceEnv



参考:

https://github.com/uvipen/Super-mario-bros-A3C-pytorch/issues/3

https://github.com/ray075hl/PPO_super_mario/issues/1