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


相关推荐

  • Android 代码混淆 选项说明[通俗易懂]

    Android 代码混淆 选项说明[通俗易懂]转载请注明出处:Android代码混淆选项说明http://blog.csdn.net/jjwwmlp456/article/details/44977721—————–匆忙拥挤repeat语法规范说明地址:https://stuff.mit.edu/afs/sipb/project/android/sdk/android-…

    2022年5月29日
    77
  • log4j2.xml配置文件详解_log4j配置日志文件目录

    log4j2.xml配置文件详解_log4j配置日志文件目录log4j.xml配置文件详解一log4j.xml配置<?xmlversion=”1.0″encoding=”UTF-8″?><!DOCTYPElog4j:configurationSYSTEM”log4j.dtd”><log4j:configuration><!–将日志信息输出到控制台–>&lt…

    2022年9月30日
    3
  • WinAPI CreateThread

    WinAPI CreateThreadHANDLECreateThread(LPSECURITY_ATTRIBUTESlpThreadAttributes,DWORDdwStackSize,LPTHREAD_START_ROUTINElpStartAddress,LPVOIDlpParameter,DWORDdwCreationFlags,LPDWORDlpThreadId);编辑本段参数说明…

    2022年7月11日
    17
  • plsql developer配置数据库连接_plsql使用教程

    plsql developer配置数据库连接_plsql使用教程一、概念PL/SQLDeveloper是一个集成开发环境,专门面向Oracle数据库存储程序单元的开发。如今,有越来越多的商业逻辑和应用逻辑转向了OracleServer,因此,PL/SQL编程也成了整个开发过程的一个重要组成部分。PL/SQLDeveloper侧重于易用性、代码品质和生产力,充分发挥Oracle应用程序开发过程中的主要优势。Oracle数据库并不提供图形界面的开发…

    2022年9月25日
    3
  • 外键(FOREIGN KEY)

    外键(FOREIGN KEY)引子:把所有数据都存放于一张表的弊端  1、表的组织结构复杂不清晰  2、浪费空间  3、扩展性极差为了解决上述的问题,就需要用多张表来存放数据。表与表的记录之间存在着三种关系:一对多、多对多、一对一的关系。处理表之间关系问题就会利用到FOREIGNKEY多对一关系:寻找表与表之间的关系的套路  举例:雇员表:emp表  部门:dep表    part1:    …

    2022年6月29日
    29
  • vdbench的作用_vdbench

    vdbench的作用_vdbench一、vdbench安装1、安装java:java-version(vdbench的运行依赖于java)2、检测vdbench能够使用:进入vdbench相应目录下./vdbench-t来测试一下vdbench的可用性,如果正常,会在目录下自动生成一个output目录。root@node1:/home/vdbench/vdbench50406#./vdbench-t如果报错,则需修改vdb…

    2022年5月20日
    77

发表回复

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

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