安装pytorh

准备linux环境 & linux环境下的准备操作
  1. 可以使用虚拟机 eg. VMware Workstation-虚拟机软件、Ubuntu ISO-镜像文件
  2. 更新apt
1. sudo apt-get update

2. sudo apt-get install vim

3. 更换apt的镜像源-提升下载速度
vim /etc/apt/sources.list

删除原内容,粘贴以下内容,建议用第二个清华源

阿里源

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

清华源 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
4. sudo apt-get update
  1. 查看python版本
python -version
  1. 安装pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
这时候执行pip命令,会提示没有/usr/bin/pip,那么需要移动文件夹,即执行以下命令
sudo mv /usr/local/bin/pip /usr/bin/pip
  1. 查看pip版本
pip --version
安装Pytorh
  1. run this command
sudo pip install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl

成功则提示 Successfully installed numpy-1.13.3 pyyaml-3.12 torch-0.2.0.post3

  1. run this command
sudo pip install torchvision

成功则提示Successfully installed torchvision-0.1.9

你可能感兴趣的:(安装pytorh)