[英]Python error - “ImportError: No module named”
First of all this is what my directory looks like: 首先,这是我的目录的样子:
.:
ref.py main.py utility
./utility:
file_manip.py
When I execute main.py
I get this error: 当我执行
main.py
以下错误:
>>> python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
import utility.file_manip as fm
ImportError: No module named utility.file_manip
I cannot for the life of me get to the bottom of this. 我无法为自己的生活深究。 Clearly utility.file_manip exists...
显然Utility.file_manip存在...
You need a blank __init__.py
file in your utility directory in order for Python to see it as a package. 您需要在实用程序目录中有一个空白的
__init__.py
文件,以便Python将其视为软件包。 See the tutorial . 请参阅教程 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.