添加模塊我有我的Python項目的以下文件夾結構:的Python:如何從同級文件夾
pythonApp --> Folder
|--ABC --> Package
|--__init__.py --> Empty File
|--abctest.py --> Module
|--DEF --> Package
|--__init__.py --> Empty File
|--deftest.py --> Module
|--Common --> Package
|--__init__.py --> Empty File
|--constants.py --> Module
我想導入constants.py
的Common
包在abctest.py
下。使用from Common import constants
將拋出錯誤Module not found
。有沒有解決方案。
你有'__init __。py'在'pythonApp'根目錄嗎? –
@GarrettKadillak:是的,在pythonApp根目錄下,我有__init__.py文件 – Quest