我對Python非常陌生,對我來說很裸露。我無法在最簡單的實現下導入模塊。我看過其他SO帖子,他們更復雜,我很難跟隨。我想這是一個Python配置錯誤,但我想在我去挖掘任何庫或路徑語句(如果沒有必要)之前確定。無法使用Python導入模塊3
[modone.py]:
import modtwo.py
mod1 = "I am module #1"
print(mod1)
print(mod2)
[modtwo.py]:
mod2 = "I am module #2"
沒有得到比這更基本的......然而,這是我收到的輸出外殼:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1521, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\OTI\Scripts\Python\Script1\modone.py", line 1, in <module>
import modtwo.py
ImportError: No module named 'modtwo.py'; modtwo is not a package
謝謝。直到我明白這一點之後,我才能繼續上課。 –