我正在获取ModuleNotFoundError
。它说没有名为“ torch._C”的模块。我不知道如何解决这个错误。我该怎么办?我已经包括了追溯,也许有帮助(最近一次通话是最后一次):
File "/home/pi/Downloads/****/main.py", line 9, in <module>
from run import process
File "/home/pi/Downloads/****/run.py", line 4, in <module>
from gan import DataLoader, DeepModel, tensor2im
File "/home/pi/Downloads/*****/gan.py", line 4, in <module>
import torchvision.transforms as transforms
File "/home/pi/.local/lib/python3.7/site-packages/torchvision/__init__.py", line 1, in <module>
from torchvision import models
File "/home/pi/.local/lib/python3.7/site-packages/torchvision/models/__init__.py", line 1, in <module>
from .alexnet import *
File "/home/pi/.local/lib/python3.7/site-packages/torchvision/models/alexnet.py", line 1, in <module>
import torch.nn as nn
File "/home/pi/.local/lib/python3.7/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ModuleNotFoundError: No module named 'torch._C'
您能帮助解决这个问题吗?
我相信问题是您在同一目录中有一个名为“ torch”的文件夹:)
尝试更改您的位置(cd ..)并运行python [... / yourfile.py]