船新UBUNTU 安装openai 从零开始 @TOC
从零开始 openai 安装 pytorch1.3.1安装
新手上车,装了一个星期,从第一句cd命令开始,真是令人头皮发麻!
咱就从换源开始,一步步安装openai
一、换源
二、输入法安装
三、openai安装
五、Fm
一、换源
1.备份文件
sudo cp /etc/apt/sources.list sources_backup.list
2.修改文件
sudo gedit /etc/apt/sources.list
3.写入源,保存。(ubuntu16.04)
#清华大学源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
#阿里云源
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
阿里源(ubuntu18.04)
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
阿里源(ubuntu20.04)
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
阿里镜像站
https://developer.aliyun.com/mirror/ubuntu/?spm=a2c6h.25603864.0.0.47634af3iBaqpg
3.更新
a.这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。我们在新立得软件包管理器里看到的软件列表,都是通过update命令更新的。
sudo apt-get update
b.解决各种缺少依赖问题
sudo apt-get -f install
c.这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,就会提示你更新。
sudo apt-get upgrade
安装驱动
1、卸载驱动
sudo apt-get remove nvidia-*
2、查询可用驱动
sudo ubuntu-drivers devices
会出现类似的 (每个版本 因时间推进而可能版本号不同 以自己的为准
driver : nvidia-driver-470 - distro non-free driver : nvidia-driver-460-server - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin
3、选取在上面列表中自己需要的列表中的驱动安装即可 一般不推荐安装test的驱动
sudo apt install nvidia-driver-470
4、检验驱动是否安装成功
sudo nvidia-smi
5、编辑内核
sudo nano /etc/modprobe.d/blacklist.conf
文件末尾加上 blacklist nouveau 然后保存
sudo update-initramfs -u
使改动生效,这句很重要
7、重启
sudo reoot
二、输入法安装
https://blog.csdn.net/sandalphon4869/article/details/100781978
https://jingyan.baidu.com/article/fec4bce28610c4f2618d8b13.html
(ubuntu18.04)
https://blog.csdn.net/qq_27211927/article/details/80877684
IBus与fcitx切换的时候记得要重启
1.v2ay
/opt/v2ray/v2ray-linux-64/v2ray
/opt/v2ray/v2ray-linux-64
2.sh文件安装
bash xxxxx
三、openai安装
openai官网教程
这个是openai官方的教程页面
1.Anaconda(Anaconda3-5.3.0)
官方历史版本,找到Anaconda3-5.3.0-Linux-x86_64.sh
官方教程用的是5.3.0,跟着官方推荐一步一步装准没错!
https://repo.anaconda.com/archive/
下载完成,打开终端,进行安装
bash ~/Downloads/Anaconda3-5.3.0-Linux-x86_64.sh
安装完成后需要关闭终端再次打开,Anaconda才能生效
2.spinningup环境创建
创建一个spinningup的环境(这个名字可以随便改) 使用python3.6
conda create -n spinningup python=3.6
3.进入spinningup的环境
在之前创建好的环境中继续安装 接下来的环境依赖包
conda activate spinningup
4.安装OpenMPI
sudo apt-get update && sudo apt-get install libopenmpi-dev
5.git安装
sudo apt install git
6.安装Spinning Up
从github把Spinning Up载到本地
git clone https://github.com/openai/spinningup.git
移动到spinningup文件夹
cd spinningup
执行安装
pip install -e .
四、报错
安装pytorch1.3.1失败
下载到99%后突然崩了
tensorflow镜像
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/tensorflow/
解决方案:
1.下载好需要的pytorch版本
pytorch各个版本的.whl文件下载地址
https://download.pytorch.org/whl/torch_stable.html
2.下载完成后,进入文件目录,进行pip安装就行了
pip install torch-1.3.1-cp36-cp36m-linux_x86_64.whl
3.安装完成后再次回到sinningup文件进行
pip install -e .
五、Fm
1.更新软件
sudo apt-get update
2.安装推荐软件
sudo apt-get install -y --no-install-recommends build-essential
sudo apt-get install -y --no-install-recommends cmake
sudo apt-get install -y --no-install-recommends libzmqpp-dev
sudo apt-get install -y --no-install-recommends libopencv-dev
3.创建conda环境
conda create --name Fm python=3.6
conda activate Fm
4.git下载flightmare
cd ~/Desktop
git clone https://github.com/uzh-rpg/flightmare.git
5.添加环境变量
echo “export FLIGHTMARE_PATH=~/Desktop/flightmare” >> ~/.bashrc
source ~/.bashrc
6.安装依赖
conda activate Fm
cd flightmare/
install tensorflow GPU (for non-gpu user, use pip install tensorflow==1.14)
pip install tensorflow-gpu==1.14
install scikit
pip install scikit-build
记得安装eigen3.3.4
7.安装flightmare
cd flightmare/flightlib
it first compile the flightlib and then install it as a python package.
编译需要核数>4,内存>4G
pip install .