使用gym环境时报错:AttributeError: module ‘gym.envs.box2d’ has no attribute ‘BipedalWalker’

使用gym中"BipedalWalker-v3"环境的时候出现了如下报错:

AttributeError: module ‘gym.envs.box2d’ has no attribute
‘BipedalWalker’

在这里插入图片描述

解决办法:

1、下载swig包
在https://www.swig.org/download.html 下载swig包,解压保存在某路径,我安装在D:\swigwin-4.0.2
也可以在此处下载

2、添加环境变量
pycharm中file -> settings -> Build, Execution, Deployment -> Console -> Python Console -> Environment variables 输入swig=D:\swigwin-4.0.2\swig.exe,确认

在这里插入图片描述
在这里插入图片描述
3、下载wheel:
在https://www.lfd.uci.edu/~gohlke/pythonlibs/#pybox2d下载适合的版本的Box2D包
也可以在此处下载
找到存储的位置:C:\Users\thinkpad\Downloads\Box2D-2.3.10-cp39-cp39-win_amd64.whl

4、执行:

pip install C:\Users\thinkpad\Downloads\Box2D-2.3.10-cp39-cp39-win_amd64.whl

运行结果如下图所示:

在这里插入图片描述
然后程序可以正常运行(安装完后wheel文件就可以删除了)

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值