开发者

如何解决import torchvision报错问题 DLL:找不到模块

开发者 https://www.devze.com 2024-01-31 09:18 出处:网络 作者: Amberrr-L
目录import torchvision报错DLL:找不到模块解决方法总结import torchvision报错DLL:找不到模块
目录
  • import torchvision报错DLL:找不到模块
  • 解决方法
  • 总结

import torchvision报错DLL:找不到模块

import torch 成功

但是import torchvision,报错

DLL:找不到模块

网上说可能是nump编程客栈y版本的问题,pillow版本的问题,按照方法更改后都没用。

看到的另一个原因:可能是torch和torchvision 版本不对应

解决方法

https://pytorch.org/get-started/locally/ 打开官网,选择你相应的配置,我是CPU版本。

如何解决import torchvision报错问题 DLL:找不到模块

图片最后一行给出了怎么安装的代码。

pip3 install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

打开Ananconda prompt 进入pytorch环境,卸载torch 和torchvision

pip uninstall torchvision
pip uninstall torch

安装之前加上清华源下载更快

添加清华镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
#添加清华镜像
conda configandroid --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

再重新使用官网给出两者版本一致的的代码:

pip3 install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://jsdownload.pytorch.org/whl/torch_stable.html

就安装成功了。

import torchvis编程ion验证,就不报错了。

总结

以上为个人javascript经验,希望能给大家一个参考,也希望大家多多支持编程客栈(www.devze.com)。

0

精彩评论

暂无评论...
验证码 换一张
取 消