MuJoCo安装

现在mujoco的安装变得非常简单:

pip install mujoco

即可!

 

下面是过去安装mujoco的方式:

1. 下载MuJoCo可执行文件:Linux: https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz    Mac: https://mujoco.org/download/mujoco210-macos-x86_64.tar.gz

2. 解压文件tar -zxvf mujoco210-linux-x86_64.tar.gz

3.把解压后的mujoco210文件夹放在~/.mujoco目录下

4. ~/.zshrc或者~/.bashrc中添加:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/huangshiyu/.mujoco/mujoco210/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia

5. source ~/.zshrc

6. sudo apt-get install libglew-dev patchelf -y

7. 测试:

import mujoco_py
import os
mj_path = mujoco_py.utils.discover_mujoco()
xml_path = os.path.join(mj_path, 'model', 'humanoid.xml')
model = mujoco_py.load_model_from_path(xml_path)
sim = mujoco_py.MjSim(model)
print(sim.data.qpos)
sim.step()
print(sim.data.qpos)

 

 

 

参考资料:https://github.com/openai/mujoco-py#install-mujoco

posted @ 2022-09-14 16:03  Shiyu_Huang  阅读(1193)  评论(0编辑  收藏  举报