我正在嘗試對(duì)我的代碼進(jìn)行模塊化,但遇到了問(wèn)題。我的文件夾是這樣構(gòu)造的:code |_main.py |_test1 |_calcA.py (which contains a method) |_test2 |_calcB.py (which contains another method) |_test3 |_calcC.py (which contains another method)現(xiàn)在我的main.py包含以下幾行:import sys; import pprintpprint.pprint(sys.path)from test1.calccircle.py import calcAfrom test2.calctriangle.py import calcBfrom test3.calccarre.py import calcB出現(xiàn)以下錯(cuò)誤:ImportError:沒(méi)有名為“ test1.calcA.py”的模塊;'test1.calcA'不是一個(gè)軟件包
添加回答
舉報(bào)
0/150
提交
取消