火炬循环导入属性错误

问题描述 投票:0回答:1

我正在尝试使用使用 torch 的脚本,但我不断收到此属性错误:

AttributeError: partially initialized module 'torch' has no attribute 'Tensor' (most likely due to a circular import)

我尝试过跑步

pip3 uninstall torch
pip3 uninstall torchvision
pip3 uninstall torchaudio
pip3 install torch
pip3 install torchvision
pip3 install torchaudio

但这对我不起作用。有人知道我该如何解决这个问题吗?任何帮助将不胜感激!

pytorch tensor torch ubuntu-22.04 layout-parser
1个回答
0
投票

您尝试运行的脚本很可能与 torch 或它导入的东西想要导入的模块命名相同。尝试重命名您的脚本。

© www.soinside.com 2019 - 2024. All rights reserved.