[877]ModuleNotFoundError:no module named ‘tools.nnwrap‘ 解决办法

时间:2022-07-22
本文章向大家介绍[877]ModuleNotFoundError:no module named ‘tools.nnwrap‘ 解决办法,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

使用pip install torch,命令安装torch库,提示如下错误:

File "D:soft环境变量TEMPpip-install-xytf4pybtorchsetup.py", line 51, in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'

最后在PyTorch官网利用其提供的安装命令,成功安装torch库。

根据自己的电脑配置选择安装命令

pip安装

pip install torch===1.5.1 torchvision===0.6.1 -f https://download.pytorch.org/whl/torch_stable.html

成功安装

Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch===1.5.1
  Downloading https://download.pytorch.org/whl/cu102/torch-1.5.1-cp36-cp36m-win_amd64.whl (913.8MB)
     |████████████████████████████████| 913.8MB 8.7kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/torchvision/
Collecting torchvision===0.6.1
  Downloading https://download.pytorch.org/whl/cu102/torchvision-0.6.1-cp36-cp36m-win_amd64.whl (1.2MB)
     |████████████████████████████████| 1.2MB 547kB/s
Requirement already satisfied: future in d:softpython3.6libsite-packages (from torch===1.5.1) (0.16.0)
Requirement already satisfied: numpy in d:softpython3.6libsite-packages (from torch===1.5.1) (1.16.6)
Requirement already satisfied: pillow>=4.1.1 in d:softpython3.6libsite-packages (from torchvision===0.6.1) (6.2.0)
Installing collected packages: torch, torchvision
Successfully installed torch-1.5.1 torchvision-0.6.1

参考:https://blog.csdn.net/cxyj666/article/details/97617358