Python はローカル ディレクトリにインストールされます。
私のディレクトリツリーは次のようになります。
(local directory)/site-packages/toolkit/interface.py
私のコードはここにあります:
(local directory)/site-packages/toolkit/examples/mountain.py
この例を実行するにはpython mountain.py
、次のコードを記述します。
from toolkit.interface import interface
そして、私はエラーが発生します:
Traceback (most recent call last):
File "mountain.py", line 28, in ?
from toolkit.interface import interface
ImportError: No module named toolkit.interface
私はすでにチェックしてsys.path
おり、そこにディレクトリがあり/site-packages
ます。また、__init__.py.bin
これがパッケージであることを Python に示すために、toolkit フォルダーにファイルがあります。__init__.py.bin
サンプルディレクトリにもあります。
にあるときに Python がファイルを見つけられない理由がわかりませんsys.path
。何か案は?パーミッションの問題でしょうか? 実行許可が必要ですか?