今天在运行github的代码https://github.com/DarylRodrigo/rl_lib/tree/master/PPO 出现了下面的问题:

......
envs.py", line 29, in reset
noops = self.unwrapped.np_random.randint(1, self.noop_max + 1) #pylint: disable=E1101
AttributeError: 'numpy.random._generator.Generator' object has no attribute 'randint'

解决方法

把envs.py的29行换成

noops = self.unwrapped.np_random.integers(1, self.noop_max + 1)

就OK了。

参考文献

[1].​​[RLlib] AttributeError: ‘numpy.random._generator.Generator’ object has no attribute ‘randint’ in “…/ray/rllib/env/wrappers/atari_wrappers.py”​