使用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文件就可以删除了)