【发布时间】:2022-08-15 17:20:32
【问题描述】:
我正在尝试运行我的 python 文件。我正在运行这个命令:
python3 run.py --input_folder test_images/old_w_scratch --output_folder output --GPU 0 --with_scratch
但我得到这个错误:
Running Stage 1: Overall restoration
Traceback (most recent call last):
File \"detection.py\", line 12, in <module>
import torch
ImportError: No module named torch
Traceback (most recent call last):
File \"test.py\", line 6, in <module>
from torch.autograd import Variable
ImportError: No module named torch.autograd
Traceback (most recent call last):
当我安装torch 时,它安装正确。但是当我运行它时,它不起作用。有人可以帮助我吗?
-
你是在 conda 还是 vitual env 中运行 torch,如果是这样,你可能没有激活它
-
@Kenan 实际上也不是。我也在mac上
-
我建议使用 conda 环境
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch检查 cuda -
你是如何安装
torch的?