Closed morning-hao closed 3 months ago
@morning-hao
由于 Gym 库 0.26.0 及其之后的版本对之前的代码不兼容,所以我们安装 0.26.0 之前的 Gym,比如 0.25.2。
pip install gym==0.25.2
@morning-hao
由于 Gym 库 0.26.0 及其之后的版本对之前的代码不兼容,所以我们安装 0.26.0 之前的 Gym,比如 0.25.2。
pip install gym==0.25.2
可以了,谢谢大佬~
@morning-hao
由于 Gym 库 0.26.0 及其之后的版本对之前的代码不兼容,所以我们安装 0.26.0 之前的 Gym,比如 0.25.2。
pip install gym==0.25.2
可以了,谢谢大佬~
客气啦~
运行Q-learning这个notebook,然后报了这个错误: https://github.com/datawhalechina/easy-rl/blob/master/notebooks/Q-learning/QLearning.ipynb
TypeError Traceback (most recent call last) Cell In[6], line 4 2 cfg = Config() 3 # 训练 ----> 4 env, agent = env_agent_config(cfg) 5 res_dic = train(cfg, env, agent) 7 plot_rewards(res_dic['rewards'], title=f"training curve on {cfg.device} of {cfg.algo_name} for {cfg.env_name}")
Cell In[4], line 5, in env_agent_config(cfg, seed) 2 def env_agent_config(cfg,seed=1): 3 '''创建环境和智能体 4 '''
----> 5 env = gym.make(cfg.env_name,new_step_api=True)
6 env = CliffWalkingWapper(env) 7 n_states = env.observation_space.n # 状态维度
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\gym\envs\registration.py:156, in make(id, kwargs) 155 def make(id, kwargs): --> 156 return registry.make(id, **kwargs)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\gym\envs\registration.py:101, in EnvRegistry.make(self, path, kwargs) 99 logger.info('Making new env: %s', path) 100 spec = self.spec(path) --> 101 env = spec.make(kwargs) 102 # We used to have people override _reset/_step rather than 103 # reset/step. Set _gym_disable_underscore_compat = True on 104 # your environment if you use these methods and don't want 105 # compatibility code to be invoked. 106 if hasattr(env, "_reset") and hasattr(env, "_step") and not getattr(env, "_gym_disable_underscore_compat", False):
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\gym\envs\registration.py:73, in EnvSpec.make(self, kwargs) 71 else: 72 cls = load(self.entry_point) ---> 73 env = cls(_kwargs) 75 # Make the enviroment aware of which spec it came from. 76 env.unwrapped.spec = self
TypeError: init() got an unexpected keyword argument 'new_step_api'
尝试了几个gym的版本也不行