python命令行执行 ImportError 模块找不到 解决

2018-11-26  本文已影响0人  Janny_a705

在文件开头加入以下代码,即可

import sys

import os

curPath = os.path.abspath(os.path.dirname(__file__))

rootPath = os.path.split(curPath)[0]

sys.path.append(rootPath)

切记,是文件开头加入,验证可行。

上一篇 下一篇

猜你喜欢

热点阅读