更新源

https://www.cnblogs.com/leeyazhou/p/12976814.html

  1. deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
  2. deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
  4. deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
  6. deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
  7. deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
  9. deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

安装软件

Vim

虚拟机中居然没安装 vim
image.png

  1. sudo apt install vim

Zsh

  1. wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

zsh+on-my-zsh配置教程指南(程序员必备)【已备份】

  1. git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  2. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  3. sudo vim ~/.zshrc
  4. plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
  5. source ~/.zshrc

VSCode 连接虚拟机

image.png
ip 地址为 192.168.128.130 , 先开启 SSH 服务

Conda

https://blog.csdn.net/WannaSeaU/article/details/88427010

Pip

  1. import tensorflow as tf
  2. print(tf.__version__)
  3. print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
  1. import torch
  2. flag = torch.cuda.is_available()
  3. print(flag)
  4. ngpu= 1
  5. # Decide which device we want to run on
  6. device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
  7. print(device)
  8. print(torch.cuda.get_device_name(0))
  9. print(torch.rand(3,3).cuda())

查看占用

  1. sudo du -sh /home/*