Created
October 11, 2016 08:28
-
-
Save punkmonday/984a18b866b938dcce44111a4d39d38d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__init__.py里import的模块,实际运行的时候是在当前的目录(就是你目前所在的目录)寻找package,而不是__init__.py所在目录,所以就会导致找不到模块 | |
所以要真正能导入,需要 | |
import sys | |
sys.path.append("__init__.py所在目录") | |
之后 | |
import 的模块就会到append的路径里查找模块了 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment