安装Atari环境报错缺少ale_c.dll解决办法
背景:
在Atari游戏环境中做RL测试。通过anaconda新建了环境,配置好torch,numpy,gym等环境。运行中报错如下:
1 | FileNotFoundError: Could not find module 'D:\Anaconda3\envs\PPOenv\lib\site-packages\atari_py\ale_interface\ale_c.dll' (or one of its dependencies). Try using the full path with constructor syntax. |
意思是所显示路径下缺少ale_c.dll
处理方法:
方法1(对我情况无效,但点赞很多)
首先检索到了这个方案(作者@razzzu)
https://github.com/openai/gym/issues/1726
Step1: 卸载相关库
1 | pip uninstall atari-py |
Step2: 安装 VS build tools工具
Download VS build tools here: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
运行后勾选左侧“C++ build tools”以及右侧的
- MSVC v142-VS 2019 C++ x64/x86 build tools
- windows 10 SDK
- C++ CMaKer
- Testing tools core features - build tools
Step3: 重启电脑
Step4: 重新安装库
1 | Install cmake, atari-py and gym |
Step5: 运行测试
1 | Now run the following code: |
and if everything worked then it should return a list of all games as shown below
1 | ['adventure', 'air_raid', 'alien', 'amidar', 'assault', 'asterix', 'asteroids', 'atlantis', 'bank_heist', 'battle_zone', 'beam_rider', 'berzerk', 'bowling', 'boxing', 'breakout', 'carnival', 'centipede', 'chopper_command', 'crazy_climber', 'defender', 'demon_attack', 'double_dunk', 'elevator_action', 'enduro', 'fishing_derby', 'freeway', 'frostbite', 'gopher', 'gravitar', 'hero', 'ice_hockey', 'jamesbond', 'journey_escape', 'kaboom', 'kangaroo', 'krull', 'kung_fu_master', 'montezuma_revenge', 'ms_pacman', 'name_this_game', 'phoenix', 'pitfall', 'pong', 'pooyan', 'private_eye', 'qbert', 'riverraid', 'road_runner', 'robotank', 'seaquest', 'skiing', 'solaris', 'space_invaders', 'star_gunner', 'tennis', 'time_pilot', 'tutankham', 'up_n_down', 'venture', 'video_pinball', 'wizard_of_wor', 'yars_revenge', 'zaxxon'] |
我在完成上述步骤后发现还是缺少ale_c.dll,于是打算直接下载一个ale_c.dll
方法2 (有效)
Step1: Download ale_c.dll from here.(下载需要梯子,我在博客img中放了文件备份) Step2: Copy it in C:Raval-packages_py_interface (Your path can be different).
成功解决问题!