python - .py 不从内容文件夹中读取

标签 python python-3.x deep-learning pytorch google-colaboratory

|-content 
  |-utils
    |- parse_config.py
  |-models.py

folder structure 这是我在 google colab 中的文件夹结构。

我已经安装了 Pytorch 以及该项目的所有其他要求。 这里的 models.py 文件无法访问 utils 文件夹中的文件。

在我的 models.py 中,我正在导入位于 utils 文件夹内的 utils.parse_config,但它显示以下错误。

ImportErrorTraceback (most recent call last) <ipython-input-6-77f4a3369184> in <module>()
----> 1 from models import *
      2 from utils import *
      3 
      4 import os, sys, time, datetime, random
      5 import torch

/content/models.py in <module>()
      9 from PIL import Image
     10 
---> 11 from utils.parse_config import *
     12 from utils.utils import build_targets
     13 from collections import defaultdict

ImportError: No module named utils.parse_config

--------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.
---------------------------------------------------------------------------

Error

如何让 models.py 访问 utils 文件夹中的文件?

最佳答案

Models.py 似乎不在 utils 文件夹中。请重新检查

关于python - .py 不从内容文件夹中读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55129148/

相关文章:

python - 使用 imageio 包将 mp4 视频转换为 avi 视频

python - 像谷歌街景这样的图像上的对象跟踪

tensorflow - 比较 TensorFlow 和 PaddlePaddle 之间的深度学习框架

python - 更改输入大小后 tflite.allocate_tensors() 失败

javascript - 无服务器 CORS 预检请求失败 - AWS API Stripe

python - Kivy:如何创建 'blocking' 弹出窗口/模态视图?

python - 如何创建递归 Python 脚本来对文件和文件夹进行排序?

python-3.x - 通过Jupyter使用TensorFlow(Python 3)

python - 立即将用户输入输出到控制台

python-3.x - 如何让 tkinter::pack() 在下面程序的左上角放置标签?