私は USB スティックで Python を使用しており、再帰降下パーサーを設計しています。
メイン スクリプトはrecursive.py
、コマンド プロンプトから次のコードで実行されます。
python.exe compiler\recursive.py<compiler\rd_input
私のディレクトリ構造は
python.exe
compiler\
recursive.py
rd_input
私のコードでは、3 つの関数を持つ python スクリプトを生成しています。
compiler\
recursive_header.py
後でメインスクリプトにインポートする必要がありますrecursive.py
。
私は試してみましimport recursive_header
た
が、エラーが表示されていimport compiler\recursive_header
ますimport compiler/recursive_header
Traceback (most recent call last):
File "compiler\recursive.py", line 74, in <module>
import recursive_header
ImportError: No module named recursive_header
私はここで与えられた解決策を試しました。しかし、同じエラー。
も試した
import sys
sys.path.append('/compiler')
import recursive_header
ここでエラー番号が増加し、いくつかについて言及していsys
ます。
スクリプトに compiler\recursive_header.py をインポートするにはどうすればよいですか。