【发布时间】:2019-08-03 09:04:23
【问题描述】:
|-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.
---------------------------------------------------------------------------
如何让 models.py 访问 utils 文件夹中的文件?
【问题讨论】:
-
如果您想获得好的响应或任何响应,您必须包含所有相关代码。
标签: python python-3.x deep-learning pytorch google-colaboratory