【问题标题】:ModuleNotFoundError partway through running moduleModuleNotFoundError 中途运行模块
【发布时间】:2021-06-21 23:23:41
【问题描述】:

我正在使用python -m <filename> 在 Python 中运行一个文件。但是在——不是之前!——脚本执行期间,我得到了以下异常:

<Path to Python>: Error while finding module specification for 'gentests.py' (ModuleNotFoundError: __path__ attribute not found on 'gentests' while trying to find 'gentests.py'). Try using 'gentests' instead of 'gentests.py' as the module name.

有人知道怎么回事吗?

【问题讨论】:

  • 每次收到错误时都要仔细阅读,因为它是为了帮助您而提供的。

标签: python python-import


【解决方案1】:

尝试使用 'gentests' 而不是 'gentests.py' 作为模块名称。

【讨论】:

  • 我已经尝试过了,但这次成功了,奇怪。也许更改与git clean -fdx 我作为第二次尝试解决方案有关。
猜你喜欢
  • 2021-05-10
  • 1970-01-01
  • 2019-09-03
  • 1970-01-01
  • 2022-01-16
  • 1970-01-01
  • 2021-02-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多