文章目錄
安裝步驟
1.安裝anaconda
我安裝的是python3.6.6,對應的anaconda版本是anaconda3-5.2.0
之後建立虛擬環境:conda create –-name gymlab
激活虛擬環境:source activate gymlab
2. 安裝gym
gym安裝參考:https://blog.csdn.net/lmh1030838681/article/details/79409072
下載gym文件到本地
git clone https://github.com/openai/gym.git
進入gym文件夾
cd gym
進行完全安裝
pip install -e '.[all]'
對於該步驟, 如果報錯可以先安裝依賴項,鍵入命令sudo apt-get install -y python-numpy python-devcmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengllibboost-all-dev libsdl2-dev swig,然後再命令安裝。
好像會遇到找不到libav-tools包,我暫時沒安裝這個包。
如果遇到報錯是沒有安裝MuJoCo,則需要先安裝這個包,再命令安裝gym。
You appear to be missing MuJoCo. We expected to find the file here:/home/jcsa/.mujoco/mujoco200
3. 安裝MuJoCo
參考這篇:https://www.jianshu.com/p/869254fd3e21
注意這裏安裝的是最新版mujoco200
4. 安裝mujoco-py
下載文件到本地
git clone https://github.com/openai/mujoco-py.git
安裝參考這篇:http://www.luyixian.cn/news_show_12220.aspx
cd mujoco-py
cp requirements.txt requirements.dev.txt mujoco_py
cd mujoco_py
pip3 install -r requirements.txt
pip3 install -r requirements.dev.txt
然後:
cd vendor
./Xdummy-entrypoint
cd ..
python3 setup.py install
測試,安裝完成後,進入python交互環境,輸入
import mujoco_py
遇到問題:
distutils.errors.CompileError: command 'gcc' failed with exit status 1
輸出的一堆信息中有:
fatal error: GL/osmesa.h: No such file or directory
解決辦法:
sudo apt install libosmesa6-dev
5.安裝nvidia驅動、cuda、cudnn、tensorflow
https://blog.csdn.net/maoersong/article/details/89608819
https://blog.csdn.net/maoersong/article/details/90574624
6.安裝遇到的問題
安裝gym時
遇到問題1:
distributed 1.21.8 requires msgpack, which is not installed.
解決:
pip install msgpack
遇到問題2:
jupyter-console 5.2.0 has requirement prompt_toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.9 which is incompatible.
安裝低版本的prompt-toolkit,我是從pypi網站上下載whl文件後進行安裝的
pip install prompt_toolkit-1.0.16-py3-none-any.whl
但是安裝低版本的prompt-toolkit後,又遇到:
ipython 7.5.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.16 which is incompatible.
解決辦法爲升級jupyter-console爲最新版本即可,先把上一步驟prompt-toolkit的版本也升級到最新版本:
pip install -U prompt-toolkit
pip install -U jupyter-console
7.參考
https://www.jianshu.com/p/869254fd3e21
http://www.luyixian.cn/news_show_12220.aspx
https://github.com/openai/mujoco-py#install-mujoco
http://www.codexiu.cn/Linux/blog/24453/