首页 > 解决方案 > 为什么即使在正确安装后我也会收到 ModuleNotFoundError?

问题描述

我使用以下命令从 GitHub安装了一个名为External-Attention-pytorch的包

!pip install git+https://github.com/xmu-xiaoma666/External-Attention-pytorch 

它成功执行并给出以下输出

Collecting git+https://github.com/xmu-xiaoma666/External-Attention-pytorch
  Cloning https://github.com/xmu-xiaoma666/External-Attention-pytorch to /tmp/pip-req-build-lwv6us0o
  Running command git clone -q https://github.com/xmu-xiaoma666/External-Attention-pytorch /tmp/pip-req-build-lwv6us0o

后来我尝试使用以下行从已安装的包中导入一个函数

from fightingcv.attention.gfnet import GFNet

这会导致以下错误:

ModuleNotFoundError: No module named 'fightingcv.attention'

这里有什么问题?以及如何克服它?

请注意,如果需要,我会在 Google Colab 中进行。

标签: githubmodule

解决方案


推荐阅读