【发布时间】:2020-04-16 14:11:57
【问题描述】:
我在 Linux 上使用 PyCharm 2020.1。我有这样的导入语句:
from model import *
PyCharm 用红色下划线和错误消息“未解析的参考‘模型’”标记单词模型。
文件夹结构:
project
├── ...
├── Chapter6
│ └── FoolBox
│ ├── attack.py <-- this is where i want to run the code
│ ├── data.py
│ └── model.py <-- this is the file i want to import in 'attack.py'
├── Chapter7
├── ...
当我运行代码时,虽然它运行没有任何问题。如何解决 PyCharm 的这种错误行为?
【问题讨论】:
-
你的项目的文件夹结构是什么?
-
你的项目解释器配置正确了吗?
-
@jfaccioni 我编辑了问题以包含文件夹结构
-
@MachineLearner 我已经安装了所有必要的依赖项,例如带有“pip install”的 tensorflow 和傻瓜式,并且没有关于它们的错误消息。错误消息仅在我在同一目录中导入另一个文件时出现。不知道如何配置解释器,有什么提示吗?