美文网首页
安装强化学习环境

安装强化学习环境

作者: corpython | 来源:发表于2018-11-27 11:52 被阅读0次

    1.安装ubuntu16.04.1,并且安装vmtools,设置电源选项

    2.更新清华源

    cd /etc/apt/

    sudo cp sources.list sources.list.bak 备份

    sudo gedit sources.list

    改变内容:

    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

    deb http://cn.archive.ubuntu.com/ubuntu bionic main multiverse restricted universe

    deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe

    deb http://cn.archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe

    deb http://cn.archive.ubuntu.com/ubuntu bionic-proposed main multiverse restricted universe

    sudo apt-get update 更新源

    sudo apt-get upgrade 更新软件

    3.更新python至3.5

    sudo apt-get install python3 安装python3,下载的Python程序被安装在usr/local/python3.5 

    sudo cp /usr/bin/python /usr/bin/python_bak 备份2.7

    sudo rm /usr/bin/python 删除2.7链接

    sudo ln -s /usr/bin/python3.5 /usr/bin/python 指向新链接

    切换回2.7

    1sudo rm /usr/bin/python

    2sudo ln -s /usr/bin/python2.7/usr/bin/python

    ----------------------------------------------------------------------------------------

    python3.6

    sudo add-apt-repository ppa:jonathonf/python-3.6

    sudo apt-get update

    sudo apt-get install python3.6

    调整Python3的优先级,使得3.6优先级较高

    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1

    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

    更改默认值,python默认为Python2,现在修改为Python3

    sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

    sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

    如果要切换到Python2,执行:

    sudo update-alternatives --config python

    3.安装Anaconda,gym和tensorflow

    https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/下载anaconda3_4.3.0-linux-x86_64.sh

    bash Anaconda3-4.3.0-Linux-x86_64.sh 关闭重开ter

    conda create --name gymlab python=3.6创建虚拟环境为gymlab

    激活环境

    source activate gymlab

    sudo 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

    sudo apt install git

    git clone https://github.com/openai/gym.git

    cd /gym

    python -m pip install --upgrade --force pip

    注释setup.py

    #'mujoco': ['mujoco_py>=1.50', 'imageio'],

    #'robotics': ['mujoco_py>=1.50', 'imageio'],

    pip install -e '.[all]'

    pip install setuptools==33.1.1

    sudo apt-get update

    python3 -m pip install aiohttp

    python3 -m pip install --upgrade pip

    git clone https://github.com/openai/mujoco-py

    cd mujoco-py

    pip install -e . --no-cache

    4.安装tensorflow

    安装pip和依赖包

    sudo apt-get install python3-pip python3-dev

    pip install --upgrade pip

    pip3 install tensorflow(cpu版本)

    pip3 install --upgrade tensorflow-gpu(gpu)

    测试

    $python

    $import tensorflow

    5.ubuntu16.04版本 the system is running in low-graphics mode问题

    cd /etc/X11

    sudo cp xorg.conf.failsafe xorg.conf

    sudo reboot

    sudo apt-get update 更新源 

    sudo apt-get upgrade 更新软件

    进入etc/X11文件夹指令删掉xorg.conf里面内容

    相关文章

      网友评论

          本文标题:安装强化学习环境

          本文链接:https://www.haomeiwen.com/subject/txgwqqtx.html