找不到包ModuleNotFoundError


6个月前 258次点击 来自 后端

标签: Python

也不知道哪里出了问题,报错ModuleNotFoundError,只能通过退而求其次的解决问题,把项目路径加入sys.path

import os
import sys

project_path = os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + ".")
sys.path.append(project_path)
print(sys.path)  # 解决ModuleNotFoundError

Made with in Shangrao,China By Devler.

Copyright © Devler 2012 - 2022

赣ICP备19009883号-1

Top ↑