[Python] Error running code taking from Gymnasium tutorial

Discussão em 'Python' iniciado por Stack, Junho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to run the following code using PyCharm IDE

    import gymnasium as gym
    env = gym.make("LunarLander-v2", render_mode="human")
    observation, info = env.reset(seed=42)
    for _ in range(1000):
    action = env.action_space.sample() # this is where you would insert your policy
    observation, reward, terminated, truncated, info = env.step(action)

    if terminated or truncated:
    observation, info = env.reset()

    env.close()


    I got the code from here. I installed "Gymnasium" in my computer using "pip install gymnasium". The Python version I am using is "Python 3.11.5".

    ERROR: Failed building wheel for box2d-py Failed to build box2d-py ERROR: Could not build wheels for box2d-py, which is required to install pyproject.toml-based projects" - What will be the solution?

    Continue reading...

Compartilhe esta Página