Import torchvision error problem solving DLL: module not found

import torch success

But import torchvision, error

DLL: Can not find module

Numpy version of the Internet that might be a problem, pillow version of the problem, with no change in accordance with the method.

 

Another reason to see: It may be torch and torchvision version does not correspond

Solution: https://pytorch.org/get-started/locally/ Open's official website, you select the appropriate configuration, I'm CPU version.

图片最后一行给出了怎么安装的代码。
pip3 install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

Open Ananconda prompt enter pytorch environment, uninstall the torch and torchvision

pip uninstall torchvision
pip uninstall torch

Coupled with faster download before installing the Tsinghua source

Add Tsinghua Mirror

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 config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

Re-use of both official website gives a consistent version of the code:

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

On the installation was successful. import torchvision verify, not being given.

Published 10 original articles · won praise 10 · views 7519

Guess you like

Origin blog.csdn.net/qq_41647438/article/details/100710589