主要緣由:啓動腳本不在當前目錄下,沒法找到上一層app
在pycharm寫好的腳本程序,在命令行沒法運行,報錯spa
Traceback (most recent call last): File "test_alert.py", line 16, in <module> from tools.base import Sleep ModuleNotFoundError: No module named 'tools'
解決辦法:.net
project = "cnki_1" sys.path.append(os.getcwd().split(project)[0] + project)
參考文檔:命令行
https://blog.csdn.net/yt2054/article/details/81142445