C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>pip install torch==1.8.0 Looking in indexes: http://mirrors.blockelite.cn:15019/pip/pypi/+simple/ Requirement already satisfied: torch==1.8.0 in c:\programdata\anaconda3\lib\site-packages (1.8.0+cu111) Requirement already satisfied: typing-extensions in c:\users\vipuser\appdata\roaming\python\python38\site-packages (from torch==1.8.0) (4.2.0) Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (from torch==1.8.0) (1.19.5) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>d: D:\BaiduNetdiskDownload\0525_ghostv2unet\ghostunet++\UNET++\segmentation\ops_dcnv3>python setup.py install Traceback (most recent call last): File "setup.py", line 10, in <module> import torch ModuleNotFoundError: No module named 'torch'为什么会这样
时间: 2023-06-30 13:09:44 浏览: 311
Linux系统安装pytorch和torchvision:torch1.8.0+torchvision0.9.0
这个错误是因为在你运行 `python setup.py install` 命令时,找不到 `torch` 模块。你可以先在命令行中输入 `python`,然后输入以下命令来检查你是否已经成功安装了 `torch` 模块。
```python
import torch
print(torch.__version__)
```
如果出现错误,则需要重新安装 `torch` 模块。如果成功安装了 `torch` 模块,则可能是因为你的环境变量设置不正确或你的 `setup.py` 文件中没有正确引入 `torch` 模块。你可以检查一下这些问题。
阅读全文