配置Deepmind_lab环境 ubuntu18.4

一、安装 Bazel

 

1、安装相关的包

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python3

2、下载bazel--installer-linux-x86_64.sh:     

                 https://github.com/bazelbuild/bazel/releases

3、更改权限,执行安装脚本

chmod +x bazel--installer-linux-x86_64.sh
./bazel--installer-linux-x86_64.sh --user

4、添加环境变量

export PATH="$PATH:$HOME/bin"

这时bazel已经安装成功  

输入bazel进行验证:

      

 

二、安装相关环境依赖

sudo apt-get install libffi-dev gettext freeglut3-dev libsdl2-dev \
zip libosmesa6-dev python-dev python-numpy python-pil python3-dev \
python3-numpy python3-pil

三、从github上把源码clone下来

git clone https://github.com/deepmind/lab
cd lab

四、将lab文件夹下的 python.BUILD 文件的内容全部替换为:

(这一步相当相当重要,不然会报gcc错误)

cc_library(
    name = "python",
    hdrs = select(
        {
            "@bazel_tools//tools/python:PY2": glob([
                "include/python2.7/*.h",
                "lib64/python2.7/site-packages/numpy/core/include/**/*.h",
            ]),
            "@bazel_tools//tools/python:PY3": glob([
                "include/python3.6m/*.h",
                "lib64/python3.6/site-packages/numpy/core/include/**/*.h",
            ]),
        },
        no_match_error = "Internal error, Python version should be one of PY2 or PY3",
    ),
    includes = select(
        {
            "@bazel_tools//tools/python:PY2": [
                "include/python2.7",
                "lib64/python2.7/site-packages/numpy/core/include",
            ],
            "@bazel_tools//tools/python:PY3": [
                "include/python3.6m",
                "lib64/python3.6/site-packages/numpy/core/include",
            ],
        },
        no_match_error = "Internal error, Python version should be one of PY2 or PY3",
    ),
    visibility = ["//visibility:public"],
)

五、建立 DeepMind Lab 并 运行一个随机 agent. 

$ cd lab

# Build the Python interface to DeepMind Lab
lab$ bazel build -c opt //:deepmind_lab.so

# Build and run the tests for it
lab$ bazel test -c opt //python/tests:python_module_test

# Run a random agent
lab$ bazel run -c opt //:python_random_agent

六、测试迷宫游戏的例子

lab$ bazel run :python_random_agent --define graphics=sdl -- \
               --length=10000 --width=640 --height=480

配置Deepmind_lab环境 ubuntu18.4_第1张图片

人工输入控制测试游戏,运行:

lab$ bazel run :game -- --level_script=tests/empty_room_test --level_setting=logToStdErr=true

 

你可能感兴趣的:(RL)