如何配置《动手学强化学习》的环境
网站:https://hrl.boyuai.com/chapter/intro
github仓库:https://github.com/boyu-ai/Hands-on-RL/tree/main

可以看到该教程要求使用gym==0.18.3版本的gym库,本教程可以用于解决绝大多数需要使用Pendulum-v0
或者CartPole-v0
环境的学习者
新建环境
python
conda create --name myRL python=3.8
conda activate myRL
安装必要的库
pip install tqdm, matplotlib, torch
安装gym
报错如下:

解决方法:
setuptools的版本太高了,无法安装chatGPT,首先更新版本
pip install setuptools==66
下一步,修改配置文件
找到你的环境所在目录,找到其中的requirement.py
文件


在原有的parsed = _parse_requirement(requirement_string)
上方,加入下面代码
if requirement_string.find('opencv-python>=3.')>=0:
requirement_string += "0" # opencv-python>=3.0

重新安装pip install gym==0.18.3
pip list
后可以发现配置成功

运行DDPG.py
的样例代码



参考: