我的Python无法在相同目录中找到任何模块。我做错了什么?(Python2.7)
因此,我有一个名为“2014_07_13_test”的目录,其中包含两个文件:
- test.py
- hello.py
其中hello.py文件内容为:
# !/usr/local/bin/python
# -*- coding: utf-8 -*-
def hello1():
print 'HelloWorld!'
和 test.py:
# !/usr/local/bin/python
# -*- coding: utf-8 -*-
from hello import hello1
hello1()
依然给我带来 Python
>>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 4, in <module>
ImportError: No module named hello
有什么问题吗?
import sys; sys.path
的输出是什么? - Salem>>> import test
- martineau