我自己新建了一个python包,名字:base,在其他的文件中想要使用这个包,就得像下面这样import进来
from base.run_method import RunMethod
在这里插入图片描述
解决方法:
进入 python 运行环境
import sys
import os
curPath = os.path.abspath(os.path.dirname(file))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
在这里插入图片描述
在这里插入图片描述

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐