虚拟环境 - 如何导入导入的本地模块?

Virtual environment - how to import in imported local module?

我有这样的文件(在 Python34 的虚拟环境文件夹中):

myfolder/
    __init__.py
    other_file.py
test.py

如果我调用 test.py,它会从 other_file.py

导入 myfolder__init__.py 导入函数
from other_file import a, b, c

这会引发错误:

ImportError: No module named 'other_file'

没有导入本地文件的脚本可以使用这个虚拟环境。它也适用于没有虚拟环境的 Pyton27。

我做错了什么?是虚拟环境的问题吗?它是否允许从本地模块(未安装)导入?还是 Python27 和 Python34 的区别?

提前致谢。

试试这个:

from myFolder.other_file import a, b, c