torchvision – ImportError: No module named torchvision

torchvision – ImportError: No module named torchvisiontorchvision-ImportError:NomodulenamedtorchvisionimageandvideodatasetsandmodelsfortorchdeeplearningThetorchvisionpackageconsistsofpopulardatasets,modelarchitectures,andcommonimagetransformationsforcomputervision.1.Installat

大家好,又见面了,我是你们的朋友全栈君。



torchvision – ImportError: No module named torchvision

image and video datasets and models for torch deep learning
The torchvision package consists of popular datasets, model architectures, and common image transformations for computer vision.

1. Installation

Anaconda:

conda install torchvision -c pytorch

pip:

pip install torchvision

From source:

python setup.py install

2. Documentation

You can find the API documentation on the pytorch website: https://pytorch.org/docs/master/torchvision/

3. ImportError: No module named torchvision

yongqiang@strong-sys:~$ python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> 
>>> import torchvision
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named torchvision
>>> 
>>> exit()
yongqiang@strong-sys:~$
yongqiang@strong-sys:~$ python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> 
>>> import torchvision
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named torchvision
>>> 
>>> exit()
yongqiang@strong-sys:~$

4. sudo pip install torchvision

yongqiang@strong-sys:~$ python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> 
>>> import torchvision
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named torchvision
>>> 
>>> exit()
yongqiang@strong-sys:~$ 
yongqiang@strong-sys:~$ pip install torchvision
Collecting torchvision
  Downloading https://files.pythonhosted.org/packages/ca/0d/f00b2885711e08bd71242ebe7b96561e6f6d01fdb4b9dcf4d37e2e13c5e1/torchvision-0.2.1-py2.py3-none-any.whl (54kB)
    100% |████████████████████████████████| 61kB 402kB/s 
Collecting pillow>=4.1.1 (from torchvision)
  Downloading https://files.pythonhosted.org/packages/9a/f6/3b3c82c5c75cae471e02fb584136168d732e17ae9db2d21c5dc82f9790f8/Pillow-5.3.0-cp27-cp27mu-manylinux1_x86_64.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 2.9MB/s 
Requirement already satisfied: torch in /usr/local/lib/python2.7/dist-packages (from torchvision) (1.0.0a0+46ef2b2)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from torchvision) (1.11.0)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from torchvision) (1.15.3)
Installing collected packages: pillow, torchvision
Could not install packages due to an EnvironmentError: [Errno 13] 权限不够: '/usr/local/lib/python2.7/dist-packages/PIL'
Consider using the `--user` option or check the permissions.

yongqiang@strong-sys:~$ 
yongqiang@strong-sys:~$ sudo pip install torchvision
[sudo] yongqiang 的密码: 
The directory '/home/yongqiang/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/yongqiang/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting torchvision
  Downloading https://files.pythonhosted.org/packages/ca/0d/f00b2885711e08bd71242ebe7b96561e6f6d01fdb4b9dcf4d37e2e13c5e1/torchvision-0.2.1-py2.py3-none-any.whl (54kB)
    100% |████████████████████████████████| 61kB 413kB/s 
Collecting pillow>=4.1.1 (from torchvision)
  Downloading https://files.pythonhosted.org/packages/9a/f6/3b3c82c5c75cae471e02fb584136168d732e17ae9db2d21c5dc82f9790f8/Pillow-5.3.0-cp27-cp27mu-manylinux1_x86_64.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 1.4MB/s 
Requirement already satisfied: torch in /usr/local/lib/python2.7/dist-packages (from torchvision) (1.0.0a0+46ef2b2)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from torchvision) (1.11.0)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from torchvision) (1.15.3)
Installing collected packages: pillow, torchvision
Successfully installed pillow-5.3.0 torchvision-0.2.1
yongqiang@strong-sys:~$ 
yongqiang@strong-sys:~$ 
yongqiang@strong-sys:~$ 
yongqiang@strong-sys:~$ python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import torchvision
>>> 
>>> exit()
yongqiang@strong-sys:~$ 
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/152611.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • HTML添加背景图片_html背景图片铺满网页

    HTML添加背景图片_html背景图片铺满网页2020-04-27 每日一例第43天1.后台代码<html><center><head>0420html中div的用法</head>

  • es数据库查询API「建议收藏」

    es数据库查询API「建议收藏」1.背景ES数据库是非关系型数据库2.ES数据库优点1.存储优化内存中使用有限状态机FST优化本质上是前缀树加上后缀树的结合,利用这个数据结构可以把Term更节省内存地放置并查询,它有着字典树的查询时间复杂度,但是由于做了后缀合并会更节约内存传统Bitmap优化使用Bitmap来记录文档的Id,每个bit对应一个文档,表示它是否存在。2.联合查询优化若要对多个t…

  • 「 运动控制 」“ADRC自抗扰控制技术”(Active Disturbance Rejection Control)研究

    「 运动控制 」“ADRC自抗扰控制技术”(Active Disturbance Rejection Control)研究近年来,虽然现代控制理论取得了一系列成果,但是在工业领域的应用并没有代替PID控制。这说明现代控制理论在实际应用的过程中受到一定的限制,控制理论与生产生活实际仍然存在一定的代沟。对此,韩京清总结为基于“模型论”的控制理论在解决问题时没有以生产生活中的不确定性作为重点,没有抓住生产生活实践中所切实需要的核心。韩京清先生针对生产生活实践中存在的问题潜心研究,积极探索,逐步分析PID理论与现代控…

  • idea配置Tomcat_tomcat docbase

    idea配置Tomcat_tomcat docbaseidea配置tomcaterror:duplicatecontextpath 解决方法:    在editconfig中部署tomcat,     server         tomcathome            D:\software……\apache-tomcat-7.0.65   …

  • 世界名着100部简介

    世界名着100部简介01、傲慢与偏见      02、孤星血泪      03、雾都孤儿        04、唐·吉诃德  05、安娜·卡列尼娜      06、飘      07、简·爱       08、悲惨世界  09、茶花女      10、基督山恩仇记      11、童年         12、这里的黎明静悄悄  13、钢铁是怎样炼成的

  • Lena图像分解成小块与从小块合成

    Lena图像分解成小块与从小块合成 ➤01背景在2020年人工神经网络课程第一次作业第八题中需要对Lena图像使用AutoEncode网络进行压缩。将Lena(灰度图像)拆解成不同尺寸的大小形成训练压缩样本过程;或者从训练结果重新组合成Lena灰度图像是实验的基础。▲Lena灰度图像下面给出相关操作的Python程序和相关的结果。主要操作包括:将512×512的Lena灰度图片(0~255)分割成边长8~16的图像块,并通过行扫描形行向量;对图像进行归一化,形成数据在-0.5~0.5之

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号