0
我的項目的結構是這樣的: project/ --bin/ ----__init__.py ----server/ ------__init__.py ------server.py ----tool/ ------__init__.py ------tool.py
ModuleNotFoundError爲多級包目錄?
在bin/server/server.py
,我有這樣導入:
from bin.tool.tool import tool_class
當我運行python3 bin/server/server.py
,我得到這個錯誤:
ModuleNotFoundError: No module named 'bin'
你是什麼意思? –
我在PyCharm中遇到了這個問題,我所做的是我去了項目設置,並且我將我的項目文件夾作爲源文件夾。這意味着我將它添加到我的源列表中。我不知道你將如何在你的IDE中做到這一點。這只是對你的暗示 – owise