私はこの構造を持っています:
テストディレクトリ:
.
├── __init__.py
└── nested
├── __init__.py
└── test.py
次に、次のようにスクリプト(python2.7)を実行しています:
~/tmp/test$./nested/test.py
test.py:
import sys
print sys.path
Linuxでこれを取得しました:
['/home/xliivdeb/tmp/test/nested', '/home/xliivdeb/tmp/test', ..]
そしてこれはWindows XPで:
['E:\\tmp\\test\\nested', 'c:\\Python27\\lib\\site-packages\\distribute-0.6.28-py2.7.egg', ..]
差分は次のとおりです。
Linux では次のものが追加されます。
- script dir ('/home/xliivdeb/tmp/test/nested') AND
- 現在のディレクトリ ('/home/xliivdeb/tmp/test')
Windows では、追加されるのは次のとおりです。
- script dir ('E:\tmp\test\nested')
なんで?それに対処する方法は?Windowsの場合、手動で追加する必要がありますか?