折腾了好久,终于装上了。记录一下。
anaconda环境安装OpenGym
- 创建环境
conda create --name gymlab python=3.5
注意官方不支持3.5以上的python - 安装gym依赖
apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
- 安装gym
git clone https://github.com/openai/gym.git
cd gym
pip install -e '.[all]'
安装过程中 mujoco_py会各种出错,不用管。不管怎么装,只要用pip装的绝对会出错。
- 安装mujoco_py
#获取mujoco:
wget -O mjpro150.zip https://www.roboti.us/download/mjpro150_linux.zip
sudo apt-get install unzip
rm -rf ~/.mujoco
mkdir ~/.mujoco
unzip mjpro150.zip -d ~/.mujoco/mjpro150
rm -rf mjpro150.zip
#把你的许可文件放进这里~/.mujoco/mjkey.txt" mujoco不是一个免费的软件,但是有edu邮箱的话可以申请一年免费试用
#install-mujoco-dependencies: 安装mujoco_py的依赖
sudo apt-get update -q
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
curl \
git \
libgl1-mesa-dev \
libgl1-mesa-glx \
libosmesa6-dev \
python3-pip \
python3-numpy \
python3-scipy \
unzip \
vim \
wget \
xpra \
xserver-xorg-dev
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
# install patch
sudo curl -o /usr/local/bin/patchelf https://s3-us-west-2.amazonaws.com/openai-sci-artifacts/manual-builds/patchelf_0.9_amd64.elf
sudo chmod +x /usr/local/bin/patchelf
#install-mujoco:安装mujuco_py
git clone https://github.com/openai/mujoco-py.git
cd mujoco-py && source activate gym && python setup.py install"
至此,安装成功。