Python项目运行找不到模块问题,python模块,背景在sublime下直


背景

在sublime下直接编译跑的:

这是目录结构:

import.py:

#coding:utf-8from rad import testif __name__ == '__main__':    test.test()

test.py:

#coding:utf-8def test():    print 'this is test module'

问题

现在打开import.py直接ctrl+b编译提示找不到rad这个module:

Traceback (most recent call last):  File "E:\py_project\py_test\main\import.py", line 2, in <module>    from rad import testImportError: No module named rad

我该怎么运行这个import.py文件?

python刚看两天,有些概念还不太清楚,见谅!

import syssys.path.append('..')from rad import testif __name__ == '__main__':    test.test()

编橙之家文章,

评论关闭