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)
全栈程序员-站长的头像全栈程序员-站长

相关推荐

  • linux 嵌入式 tts引擎_语音合成(TTS)的概念和分类[通俗易懂]

    linux 嵌入式 tts引擎_语音合成(TTS)的概念和分类[通俗易懂]智能音箱在ASR(语音识别)以及NLP自然语义处理常用框架-兔尔摩斯的文章-知乎https://zhuanlan.zhihu.com/p/55658291语音合成SpeechSynthesis或TexttoSpeech(TTS)语音合成(SpeechSynthesis)是人类语音的人工合成。用于此目的的计算机系统称为语音计算机或语音合成器,可以在软件或硬件产品中实…

    2022年4月19日
  • 串口服务器调试助手使用教程,comassistant串口调试助手使用说明.pdf

    串口服务器调试助手使用教程,comassistant串口调试助手使用说明.pdf作者:温子祺wenziqi@wenziqi@单片机多功能调试助手简介单片机多功能调试助手简介单单片片机机多多功功能能调调试试助助手手简简介介1111简介图1单片机多功能调试助手单片机多功能调试助手一款集串口/USB/网络调试、进制转换、字模与数码管字型码制作、常用校验值计算、UNICODE码转换、位图输出C文件等众多功能于一身的综合型调试软件,最值得庆幸的是该软件会一直保持更新,并支持在…

    2022年6月12日
  • 事件TransactionScope

    事件TransactionScopeusing(TransactionScopescope=newTransactionScope()){ scope.Complete();}只需要把需要事务包裹的逻辑块写在using(TransactionScopets=newTransactionScope())中就可以了。从这种写法可以看出,TransactionScope实现了IDispose接口。除…

    2022年7月24日
  • 96道前端面试题+前端常用算法「建议收藏」

    96道前端面试题+前端常用算法「建议收藏」这篇文章主要分享一些收集整理的面试题,希望能对大家有所帮助。字节一面:1,说一下浏览器缓存2,cookie与session的区别3,浏览器如何做到session的功能的。4,解释一下:csrf和xss5,怎么防止csrf和xss6,跨域的处理方案有哪些7,CORS是如何做的?8,对于CORS,Get和POST有区别吗?9,了解HTTPS的过程吗?10,esmodule和commonjs的区别11,react里如何做动态加载12,动.

    2022年8月28日
  • java pfx_如何在Java处理PFX格式证书

    java pfx_如何在Java处理PFX格式证书如何在Java处理PFX格式证书公钥加密技术12号标准(PublicKeyCryptographyStandards#12,PKCS#12)为存储和传输用户或服务器私钥、公钥和证书指定了一个可移植的格式。它是一种二进制格式,这些文件也称为PFX文件。开发人员通常需要将PFX文件转换为某些不同的格式,如PEM或JKS,以便可以为使用SSL通信的独立Java客户端或WebLogicServe…

    2022年5月1日
  • 计算机发展史的故事_了解计算机的发展史

    计算机发展史的故事_了解计算机的发展史核心提示:男人去嫖娼,就如你下馆子吃饭一样没多大区别,也没有多复杂的动机。男人自己的性欲和食欲一样,是无关感情爱情的。但几乎所有男人都明了:女人如果心甘情愿被人压在下面,这事关女人的感情。男人能把性和爱分开,而女人很难做到。计算工具的演化经历了由简单到复杂、从低级到高级的不同阶段,如从“结绳记事”中的绳结到算筹、算盘计算尺、机械计算机等。它们在不同的历史时期发挥了各自的历史作用,同时也启发了现代电…

    2022年10月19日

发表回复

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

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