在安装运行开源项目MuJoCo_RL_UR5,学习强化学习的框架时,运行python example_agent.py时,报错如下:
gym.error.NameNotFound: Environment gym_grasper:Grasper
doesn’t exist.
问题原因
注意Python Namespace的机制,确保使用了正确的Namespace
原因分析:
- 首先,在命名空间下envs下,init.py文件中注册时,注意id和entry_point, id中包含Namespace的路径 此处id应该这样写: id=“envs/Grasper-v0”
- 其次,在example_agent.py中添加import gym_grasper.envs, 为了执行环境中的__init__.py文件,即进行register
- 最后,gym.make()函数的参数要与register的参数一致,应改为:gym.make(“envs/Grasper-v0”, show_obs=False, render=True);
问题解决!!!
参考链接: https://blog.csdn.net/stanleyrain/article/details/128109966.