英文:
pip install gym-super-mario-bros in this module error is ValueError: not enough values to unpack (expected 5, got 4)
问题
尝试运行程序但出现错误:值错误:期望5个值,实际得到4个。
英文:
your text
try to run program but error Value Error: not enough values to unpack (expected 5, got 4) comes.
答案1
得分: 1
使用 v0.26 版本,您可以使用以下代码:
from nes_py.wrappers import JoypadSpace
import gym_super_mario_bros
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT
import gym
env = gym.make('SuperMarioBros-v0', apply_api_compatibility=True, render_mode="human")
env = JoypadSpace(env, SIMPLE_MOVEMENT)
done = True
env.reset()
for step in range(5000):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
if done:
state = env.reset()
env.close()
英文:
With v0.26 you can use this code
from nes_py.wrappers import JoypadSpace
import gym_super_mario_bros
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT
import gym
env = gym.make('SuperMarioBros-v0', apply_api_compatibility=True, render_mode="human")
env = JoypadSpace(env, SIMPLE_MOVEMENT)
done = True
env.reset()
for step in range(5000):
action = env.action_space.sample()
obs, reward, terminated, truncated, info
= env.step(action)
done = terminated or truncated
if done:
state = env.reset()
env.close()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论