解决思路:
- 查看当前的 path 路径是否包含 ‘xx’ 包
import sys
print(sys.path)
- 将 ‘xx’ 包的路径加进来,举例:
import os
cur_path = os.path.abspath(os.path.dirname(__file__))
root_path = os.path.split(cur_path)[0]
sys.path.append(root_path)
print("cur_path : ", cur_path)
print("root_path : ", root_path)
print("sys.path : ", sys.path)