site-packagesグローバルディレクトリへの書き込みアクセス権がないシステムで、環境を変更せずにモジュールを検出可能にしようとしています( PYTHONPATH)。.pth実行しているスクリプトと同じディレクトリにファイルを配置しようとしましたが、無視されているようです。extras.pthたとえば、次の内容のファイルを作成しました。
N:\PythonExtras\lib\site-packages
ただし、同じディレクトリに配置して実行する次のスクリプトは、を出力しFalseます。
import sys
print r"N:\PythonExtras\lib\site-packages" in sys.paths
sys.path私が書き込みアクセス権を持っている唯一のディレクトリは、スクリプトを含むディレクトリです。配置して表示できる別の(現在は存在しない)ディレクトリはありextras.pthますか?これについてもっと良い方法はありますか?
私はWindowsでPython2.7を使用しています。.pthここで見つけたすべての質問は、システムモジュールディレクトリを使用しています。
Edit: I've tracked down the Windows per-user installation directory, at %APPDATA%\Python\Python27\site-packages. I can place a module there and it will be imported, but if I put a .pth file there, it has no effect. Is this really not supposed to work, or am I doing something wrong?