0

我尝试运行以下代码来测试 HalfCheetah-v2 环境:

import gym
env = gym.make('HalfCheetah-v2')

但这给了我以下错误: ModuleNotFoundError: No module named 'mujoco_py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    env = gym.make('HalfCheetah-v2')
  File "C:\Users\Amine\AppData\Roaming\Python\Python36\site-packages\gym\envs\registration.py", line 145, in make
    return registry.make(id, **kwargs)
  File "C:\Users\Amine\AppData\Roaming\Python\Python36\site-packages\gym\envs\registration.py", line 90, in make
    env = spec.make(**kwargs)
  File "C:\Users\Amine\AppData\Roaming\Python\Python36\site-packages\gym\envs\registration.py", line 59, in make
    cls = load(self.entry_point)
  File "C:\Users\Amine\AppData\Roaming\Python\Python36\site-packages\gym\envs\registration.py", line 18, in load
    mod = importlib.import_module(mod_name)
  File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Amine\AppData\Roaming\Python\Python36\site-packages\gym\envs\mujoco\__init__.py", line 1, in <module>
    from gym.envs.mujoco.mujoco_env import MujocoEnv
  File "C:\Users\Amine\AppData\Roaming\Python\Python36\site-packages\gym\envs\mujoco\mujoco_env.py", line 14, in <module>
    raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e))
gym.error.DependencyNotInstalled: No module named 'mujoco_py'. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)

我只是找不到任何资源/网站来逐步解释如何在 Windows 上安装它。我有来自经典控件的其他经典环境,例如 CartPole 和 MountainCar。然而,来自 mujoco 的那些是论文中使用最多的。

4

1 回答 1

1

HalfCheetah-v2v1实际上)是一个MuJoCo 环境;这意味着,除了(和之前)mujoco-py,您应该首先安装 MuJoCo 本身。这些环境不适合一般使用,因为 MuJoco 是在商业许可下 - 至少直到今天(字面意思是......),DeepMind宣布他们刚刚购买了 MuJoCo,并且他们免费提供给所有人。

尽管如此,在 mujoco-py repo 的需求部分中,明确提到了:

Windows 支持已在 2.0.2.0 中弃用并删除。一个已知的良好过去版本是 1.50.1.68。

因此,没有任何 Windows 安装指南也就不足为奇了。

无论如何,你可以看看在 Windows 10 (2019)中使用 Box2D 和 Mujoco 安装 OpenAI Gym的帖子;记住上面推荐的 mujoco-py 版本,你可能会取得一些成功(不用说,最后描述的“简单”选项pip install gym[all],,将不起作用)。

其他可能有用的资源:

于 2021-10-18T20:16:29.733 回答