[英]python import not working eclipse
我剛剛開始學習python,但是我無法在eclipse中導入任何其他模塊。 我創建了1個名為
module.py
持有這個
def test():
print("this is a test")
但是當我嘗試將其導入eclipse(test.py)中的另一個文件時,它無法識別它
import module
我收到以下錯誤
Unresolved import: module
Unused import: module
――――――――――――――――――――
module Found at: myPckg.test
import module
嘗試將module.py重命名為my_module.py
另外,您可以嘗試:從my_module導入測試
module.py
def test():
print("test")
main.py
from module import test
if __name__ == '__main__':
test()
發現我需要添加的問題
import myPckg.module
就像我寫的“我剛剛開始學習..” :-)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.