ImportError: No module named torchvision

torchvison:图片、视频数据和深度学习模型

解决方案

安装torchvision,参照官网

 
pip install torchvision

安装指定版本

pip install torchvision==0.1.8 

Collecting torchvision
  Downloading https://files.pythonhosted.org/packages/ca/0d/f00b2885711e08bd71242ebe7b96561e6f6d01fdb4b9dcf4d37e2e13c5e1/torchvision-0.2.1-py2.py3-none-any.whl (54kB)
    100% |████████████████████████████████| 61kB 68kB/s
Collecting pillow>=4.1.1 (from torchvision)
  Using cached https://files.pythonhosted.org/packages/00/49/a0483e7308b4b04b5a898789911dbb876d9fea54e7df0453915e47744cfd/Pillow-5.1.0-cp27-cp27mu-manylinux1_x86_64.whl
Requirement already satisfied: torch in /home/miao/deep_ocr_env/lib/python2.7/site-packages (from torchvision) (0.3.0.post4)
Requirement already satisfied: six in /home/miao/deep_ocr_env/lib/python2.7/site-packages (from torchvision) (1.11.0)
Requirement already satisfied: numpy in /home/miao/deep_ocr_env/lib/python2.7/site-packages (from torchvision) (1.12.1)
Requirement already satisfied: pyyaml in /home/miao/deep_ocr_env/lib/python2.7/site-packages (from torch->torchvision) (3.12)
Installing collected packages: pillow, torchvision
  Found existing installation: Pillow 4.1.0
    Uninstalling Pillow-4.1.0:
      Successfully uninstalled Pillow-4.1.0
Successfully installed pillow-5.1.0 torchvision-0.2.1

你可能感兴趣的:(Python)