在学习吴恩达机器学习课程的强化学习部分的practice lab: Deep Q-Learning - Lunar Lander时出现的Gym版本问题
The gym toolkit is a collection of environments that can be used to test reinforcement learning algorithms. We should note that in this notebook we are using gym version 0.24.0.
lab开始提示用0.24.0版本的Gym,安装后出现以下警告,请问需要处理吗
Warning: Gym version v0.24.0 has a number of critical issues with `gym.make` such that the `reset` and `step` functions are called before returning the environment. It is recommend to downgrading to v0.23.1 or upgrading to v0.25.1
建议您将Gym版本降级到v0.23.1或升级到v0.25.1。这些版本应该避免上述问题。您可以使用以下命令来安装指定版本的Gym:
pip install gym==0.23.1
或
pip install gym==0.25.1
请注意,如果您已经安装了其他版本的Gym,则需要先卸载它,然后再安装指定版本。例如:
pip uninstall gym
pip install gym==0.23.1
另外,您可能需要在使用时导入指定版本的Gym,例如:
import gym
env = gym.make('LunarLander-v2')
在这种情况下,您需要将其更改为:
import gym
import gym.envs
gym.envs.registration.register(
id='LunarLander-v2',
entry_point='gym.envs.box2d:LunarLander',
max_episode_steps=1000,
reward_threshold=200,
)
env = gym.make('LunarLander-v2')