锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

Ubuntu中深度学习框架Pytorch 环境(版本通用)配置流程

时间:2022-10-22 13:30:00 贴片二极管bfp

  1. 安装虚拟机 https://download3.vmware.com/software/wkst/file/VMware-workstation-full-16.0.0-16894299.exe ZF3R0-FHED2-M80TY-8QYGC-NPKYF

  2. 下载Ubuntu20.04 默认安装在虚拟机中

  3. ubuntu换源 参考链接 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

       sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup    vi /etc/apt/sources.list    sudo vi /etc/apt/sources.list    sudo apt-get update 
  4. 安装vim sudo apt-get install vim

  5. 安装anaconda

    sudo wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh sh Anaconda3-2021.05-Linux-x86_64.sh -bfp #-bfp意思是全部默认安装 
  6. 配置conda环境变量

    vim ~/.bashrc 在首行输入export PATH=/home/username/anaconda3/bin:$PATH #username 是你自己的用户名 
  7. 创建虚拟环境

      conda create --name pt_18.1 python=3.8   #激活环境   conda activate pt_18.1 
  8. 激活环境 此时可能会提示

    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run      $ conda init  

    输入:conda init bash

    重启终端,然后再次激活环境

  9. 在pytorch官网搜索命令 https://pytorch.org/get-started/locally/ 选择自己的平台。如果您需要的版本没有显示,请单击previous-versions找到你需要的版本

    #不能使用虚拟机GPU

  10. 安装pytorch

    linux cpu选 conda install pytorch torchvision torchaudio cpuonly -c pytorch 
  11. 此刻 ,linux cpu pytorch环境已配好

  12. 开启ssh服务

    sudo apt-get install openssh-server sudo ps -e |grep ssh #显示有ssh说明开启成功 
  13. 使用ip a命令查看本机ip

    ens33: flags=4163  mtu 1500         inet 192.168.140.128  netmask 255.255.255.0  broadcast 192.168.140.255        #一般开头是en是网络适配器 inet 192.168.140.128 该ip就是ubuntu的ip 
  14. 测试ssh 在win cmd中运行 ssh username@192.168.140.128 然后输入密码 能连接代表ssh已配置完成

  15. 在pycharm里使用Linux的conda环境

    服务器账号 username@192.168.140.128 填入密码  1. pycharm添加解释器ssh interpreter   2. 选择 existing server configuration  3. 左上加号 host填192.168.140.128 用户名密码  3. Interpreter:/home/username/.conda/envs/pt_18.1/bin/python           钩上使用root权限   4. 成功  5. 性能有限只能学习用,但是跟大型gpu服务器用法一致 
  16. 至此 已完成配置

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章