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:~$ 
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

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

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 全志A33之添加电容触摸GT911驱动[通俗易懂]

    全志A33之添加电容触摸GT911驱动[通俗易懂]全志A33之添加电容触摸GT911驱动基于锐尔威视的A33开发板及提供的开发包,仅供参考。开发板说是支持GT911,其实是不支持的,得修改驱动及配置,启动文件。一.     修改配置文件/home/yygyickl/A33/dragonboard/tools/pack/chips/sun8iw5p1/configs/vstar/sys_config.fex    这是我的目录。

    2022年6月16日
    30
  • JavaScript正则表达式的两种写法[通俗易懂]

    JavaScript正则表达式的两种写法[通俗易懂]JavaScript正则表达式可以使用正则表达式的特殊符号(//)来声明,也可以采用正则表达式对象(RegExp)来声明。1、使用正则表达式符号正则表达式符号为”//”,即为2个斜杠,中间为匹配规则。JavaScript中类似的特殊符号还有数组“[]”,对象“{}”。示例:      functionprintln(str){         document

    2022年9月20日
    0
  • jedis和jediscluster_java coroutine

    jedis和jediscluster_java coroutine1.JedisCluster类结构JedisCluster是针对RedisCluster的java客户端,它封装了java访问redis集群的各种操作,包括初始化连接、请求重定向等。我们先来看下JedisCluster的类结构:jedisCluster.pngJedisCluster初始化时,所有的集群连接信息都是封装在JedisClusterInfoCache里,由于jedis本身不是线程安全…

    2022年10月15日
    0
  • java PrepareStatement[通俗易懂]

    java PrepareStatement[通俗易懂]PrepareStatementStatement对同一个sql语句charrette不同值需要重新发送一条sql语句sql注入selectusername,passwordfromempwhereusername=’admin’andpassword=’123’or1=1;insertintoempvalues(?,?,?);接口PrepareStatement表示预编译的SQL语句的对象。SQL语句被预编译并存储在Prepare…

    2022年6月8日
    62
  • Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

    Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

    2022年1月14日
    343
  • arping指令linux,arping命令详解「建议收藏」

    arping指令linux,arping命令详解「建议收藏」1版本arping主要就是查看ip的MAC地址及IP占用的问题。arping有两个版本,一个版本是ThomasHabets这个人写的,这个版本有个好处是可以arping,也就是说我们可以通过MAC地址得到IP;还有一个版本是Linuxiputilssuite的,这个版本就不能通过MAC地址,解析出IP地址了。可以使用arping-V查看系统的arping的版本[root@dev-…

    2022年6月10日
    40

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

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