关于python:添加当前python文件路径到环境变量

6次阅读

共计 181 个字符,预计需要花费 1 分钟才能阅读完成。

import os,sys
curPath = os.path.abspath(os.path.dirname(__file__))
filePath = os.path.split(curPath)[0]
sys.path.append(filePath)
sys.path.extend([filePath + '\\' + i for i in os.listdir(filePath)])
正文完
 0