我有以下文件結構的項目:上python3模塊導入不python2
test/
test.py
extra/
stuff.py
__init.py__
爲test.py的代碼很簡單:
import sys
sys.path.append("/path/to/test")
import extra
這愉快地運行使用python3 test.py
,但會沒有運行在python 2.7中,我完全難以理解這個話題的許多問題。
由Python 2.7版給出的錯誤是
Traceback (most recent call last):
File "test.py", line 3, in <module>
import extra
ImportError: No module named extra
感謝您的幫助!
感謝您的支持。 – Jack