python 命令运行环境下 ModuleNotFoundError: No module named 'Test'
解决方法有两种
1. 第一种设置环境变量法
on windows the line is : SET PYTHONPATH=%cd%;%cd%\Test NOT SET PYTHONPATH=%cd%:%cd%\Test You can test with : echo %PYTHONPATH% 2.第二种方法 进入 python 运行环境 import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath)