美文网首页
python 执行代码提示no module

python 执行代码提示no module

作者: 一束荆棘 | 来源:发表于2018-10-15 10:42 被阅读0次

    在文件的最上面添加代码,用来获取文件的绝对路径

    import sys

    import os

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

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

    sys.path.append(rootPath)

    相关文章

      网友评论

          本文标题:python 执行代码提示no module

          本文链接:https://www.haomeiwen.com/subject/ttzxzftx.html