设置文件绝对路径:
import os
import sys
currDir = os.path.dirname(os.path.realpath(file))
rootDir = os.path.abspath(os.path.join(currDir, “…/…”))
if rootDir not in sys.path:
sys.path.append(rootDir)
rootDir = os.path.abspath(os.path.join(os.getcwd(), '../../'))
sys.path.append(rootDir)