conda python==3.9
pip install gym==0.25.2
conda install swig
pip install gym[box2d]
#gym==0.25.2
obs = env.reset()
img = cv2.cvtColor(env.render()[0], cv2.COLOR_RGB2BGR)
next_obs, reward, done, _ = env.step(action)
#gym==0.26.0
obs = env.reset()[0]
img = cv2.cvtColor(env.render(), cv2.COLOR_RGB2BGR)
next_obs, reward, done, tmp1, tmp2 = env.step(action)
版本问题,现在代码改了。
env = gym.make("CliffWalking-v0", render_mode="human")
observation = env.reset()
或者
env = gym.make("CliffWalking-v0", render_mode="rgb_array")
observation = env.reset()
img = cv2.cvtColor(env.render(), cv2.COLOR_R