mujoco安装教程

ubuntu

参考:https://www.youtube.com/watch?v=Wnb_fiStFb8

Step 1:  Install anaconda

	https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
	sudo chmod +x Anaconda3-2021.11-Linux-x86_64.sh
	./Anaconda3-2021.11-Linux-x86_64.sh

Step 2 : install git


	sudo apt install git

Step 3 : install the mujoco library

1. Download the Mujoco library from 
	https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz
2. create a hidden folder :
 	mkdir /home/username/.mujoco
3. extract the library to the .mujoco folder
4. include these lines in  .bashrc file:
	export LD_LIBRARY_PATH=/home/user_name/.mujoco/mujoco210/bin
	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia
	export PATH="$LD_LIBRARY_PATH:$PATH"
	export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so

5. source .bashrc

6. Test that the library is installed by going into:
 		cd ~/.mujoco/mujoco210/bin
		./simulate ../model/humanoid.xml


Step 4 Install mujoco-py:
	conda create --name mujoco_py python=3.8
	conda activate mujoco_py
	sudo apt update
	sudo apt-get install patchelf
	sudo apt-get install python3-dev build-essential libssl-dev libffi-dev libxml2-dev  
	sudo apt-get install libxslt1-dev zlib1g-dev libglew1.5 libglew-dev python3-pip
	
	git clone https://github.com/openai/mujoco-py
	cd mujoco-py
	pip install -r requirements.txt
	pip install -r requirements.dev.txt

	pip3 install -e . --no-cache

Step 5 reboot your machine

Step 6 run these commands
	conda activate mujoco_py
	sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
	sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
	pip3 install -U 'mujoco-py<2.2,>=2.1'
	cd examples
	python3 setting_state.py

Mac M1

参考: https://github.com/openai/mujoco-py/issues/682

​ https://blog.csdn.net/skywuuu/article/details/124032887

  • 下载miniforge

    https://github.com/conda-forge/miniforge

    mujoco安装教程_第1张图片

    bash Miniforge3-MacOSX-arm64.sh
    
  • 下载mujoco2.1.1

    https://github.com/deepmind/mujoco/releases/tag/2.1.1

    下载mujoco-2.1.1-macos-universal2.dmg

    在这里插入图片描述
    接着,将MuJoCo.app拷贝到/Applications中,直接拖进去就可以了

  • 安装脚本

    mkdir -p $HOME/.mujoco/mujoco210
    ln -sf /Applications/MuJoCo.app/Contents/Frameworks/MuJoCo.framework/Versions/Current/Headers/ $HOME/.mujoco/mujoco210/include
    
    mkdir -p $HOME/.mujoco/mujoco210/bin
    ln -sf /Applications/MuJoCo.app/Contents/Frameworks/MuJoCo.framework/Versions/Current/libmujoco.2.1.1.dylib $HOME/.mujoco/mujoco210/bin/libmujoco210.dylib
    sudo ln -sf /Applications/MuJoCo.app/Contents/Frameworks/MuJoCo.framework/Versions/Current/libmujoco.2.1.1.dylib /usr/local/lib/
    
    # For M1 (arm64) mac users:
    # brew install glfw
    ln -sf /opt/homebrew/lib/libglfw.3.dylib $HOME/.mujoco/mujoco210/bin
    
    # remove old installation
    rm -rf /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/mujoco_py
    
    # which python
    # exit
    
    export CC=/opt/homebrew/bin/gcc-11         # see https://github.com/openai/mujoco-py/issues/605
    pip install mujoco-py && python -c 'import mujoco_py'
    

你可能感兴趣的:(仿真,python,linux,ubuntu)