在此模块中出现错误:ValueError: not enough values to unpack (expected 5, got 4)

huangapple go评论81阅读模式
英文:

pip install gym-super-mario-bros in this module error is ValueError: not enough values to unpack (expected 5, got 4)

问题

尝试运行程序但出现错误:值错误:期望5个值,实际得到4个。

英文:

enter image description here

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()

huangapple
  • 本文由 发表于 2023年1月9日 16:49:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75054889.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定