工作环境迁移指南

首先借一下sudo账号,登陆这台新机器。

  • 登陆之后给自己建立一个新账号:
    useradd zihao_wang
  • 给自己改个新密码:
    passwd zihao_wang
  • 给自己加上sudo权限:
    /etc/sudoers文件,在root ALL=(ALL:ALL) ALL下面加上一行zihao_wang ALL=(ALL:ALL) NOPASSWD:ALL
  • 然后给自己建一个主目录:
    mkdir /home/zihao_wang
    chown zihao_wang:zihao_wang /home/zihao_wang
  • 然后把shell改成bash
    usermod --shell /bin/bash zihao_wang

下面就不用sudo


  • 如果你和我一样使用oh-my-zsh,上面就改成zsh,然后装上oh-my-zsh(ubuntu好像不自带zsh,先用apt装一下)
    sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
  • 然后去清华镜像站下载Anaconda
    目前最新版是https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2018.12-Linux-x86_64.sh
  • 安装好Anaconda以后先加上清华的channel
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
  • 创建一个新的虚拟环境:
    conda create -n py36 python=3.6
  • 然后看看cuda版本:
    cat /usr/local/cuda/version.txt
  • pytorch官网看看怎么装:
    在这里插入图片描述
    注意这里,我们改用清华的channel了,就把-c去掉吧。
    激活一下刚装好的环境
    conda activate py36
    conda install pytorch torchvision cuda80
  • 然后去你原来机器上,把环境导出一下:
    conda list --export > requirements.txt
    这是我导出的:
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
blas=1.0=mkl
ca-certificates=2018.03.07=0
certifi=2018.11.29=py36_0
cffi=1.11.5=py36he75722e_1
freetype=2.9.1=h8a8886c_1
intel-openmp=2019.1=144
jpeg=9b=h024ee3a_2
libedit=3.1.20170329=h6b74fdf_2
libffi=3.2.1=hd88cf55_4
libgcc-ng=8.2.0=hdf63c60_1
libgfortran-ng=7.3.0=hdf63c60_0
libpng=1.6.36=hbc83047_0
libstdcxx-ng=8.2.0=hdf63c60_1
libtiff=4.0.9=he85c1e1_2
mkl=2019.1=144
mkl_fft=1.0.10=py36ha843d7b_0
mkl_random=1.0.2=py36hd81dba3_0
ncurses=6.1=he6710b0_1
ninja=1.8.2=py36h6bb024c_1
numpy=1.15.4=py36h7e9f1db_0
numpy-base=1.15.4=py36hde5b4d6_0
olefile=0.46=py36_0
openssl=1.1.1a=h7b6447c_0
pillow=5.4.1=py36h34e0f95_0
pip=18.1=py36_0
pycparser=2.19=py36_0
python=3.6.8=h0371630_0
pytorch=0.4.1=py36_py35_py27__9.0.176_7.1.2_2
readline=7.0=h7b6447c_5
setuptools=40.6.3=py36_0
six=1.12.0=py36_0
sqlite=3.26.0=h7b6447c_0
tk=8.6.8=hbc83047_0
torchvision=0.2.1=py_2
wheel=0.32.3=py36_0
xz=5.2.4=h14c3975_4
zlib=1.2.11=h7b6447c_3

刚刚装了pythonpytorchtorchvision了,把这几行删掉。

  • 去新机器上,把这些包装一下:
    conda install --file requirements.txt

  • 打开一个python,看看pytorch装好没:
    在这里插入图片描述

    看来是装好了嘻嘻。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

牛哥123

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值