ImportError:无法导入nam

2024-10-01 15:47:48 发布

您现在位置:Python中文网/ 问答频道 /正文

出于某种原因,每次我试图从另一个文件导入类时,都会收到一个ImportError。这是我的项目的github页面:https://github.com/wheelebin/mcnextbot

以下是我收到的错误:

Traceback (most recent call last):
  File "ircbot.py", line 36, in <module>
    from test import mcnextlvl
ImportError: cannot import name mcnextlvl

Tags: 文件项目httpsimportgithubcommost错误
2条回答

这里你的from test import something指的是<PYTHONPATH>/lib中的模块test,而不是你自己{},那里没有子模块/类mcnextlvl。您应该使用@sgmart评论的from lib.test import mcnextlvl。在

__init__.pypython文件允许您从lib包中导入名为“test”的各个模块。在

相关问题 更多 >

    热门问题