Esta es una lista de todos los archivos del intérprete de Python en mi equipo (que se creó similar, pero no igual que, la suya) se abre antes de que comience la ejecución de código proporcionado por mí:
$ strace -eopen python -c 1 2>&1 | grep -ve '-1 E'
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libpthread.so.0", O_RDONLY) = 3
open("/lib/libdl.so.2", O_RDONLY) = 3
open("/lib/libutil.so.1", O_RDONLY) = 3
open("/usr/lib/libssl.so.0.9.8", O_RDONLY) = 3
open("/usr/lib/libcrypto.so.0.9.8", O_RDONLY) = 3
open("/usr/lib/libz.so.1", O_RDONLY) = 3
open("/lib/libm.so.6", O_RDONLY) = 3
open("/lib/libc.so.6", O_RDONLY) = 3
open("/proc/meminfo", O_RDONLY) = 3
open("/usr/lib/python2.6/site.py", O_RDONLY) = 3
open("/usr/lib/python2.6/site.pyc", O_RDONLY) = 4
open("/usr/lib/python2.6/os.py", O_RDONLY) = 4
open("/usr/lib/python2.6/os.pyc", O_RDONLY) = 5
open("/usr/lib/python2.6/posixpath.py", O_RDONLY) = 5
open("/usr/lib/python2.6/posixpath.pyc", O_RDONLY) = 6
open("/usr/lib/python2.6/stat.py", O_RDONLY) = 6
open("/usr/lib/python2.6/stat.pyc", O_RDONLY) = 7
open("/usr/lib/python2.6/genericpath.py", O_RDONLY) = 6
open("/usr/lib/python2.6/genericpath.pyc", O_RDONLY) = 7
open("/usr/lib/python2.6/warnings.py", O_RDONLY) = 6
open("/usr/lib/python2.6/warnings.pyc", O_RDONLY) = 7
open("/usr/lib/python2.6/linecache.py", O_RDONLY) = 7
open("/usr/lib/python2.6/linecache.pyc", O_RDONLY) = 8
open("/usr/lib/python2.6/types.py", O_RDONLY) = 7
open("/usr/lib/python2.6/types.pyc", O_RDONLY) = 8
open("/usr/lib/python2.6/UserDict.py", O_RDONLY) = 5
open("/usr/lib/python2.6/UserDict.pyc", O_RDONLY) = 6
open("/usr/lib/python2.6/_abcoll.py", O_RDONLY) = 6
open("/usr/lib/python2.6/_abcoll.pyc", O_RDONLY) = 7
open("/usr/lib/python2.6/abc.py", O_RDONLY) = 7
open("/usr/lib/python2.6/abc.pyc", O_RDONLY) = 8
open("/usr/lib/python2.6/copy_reg.py", O_RDONLY) = 5
open("/usr/lib/python2.6/copy_reg.pyc", O_RDONLY) = 6
open("/usr/local/lib/python2.6/dist-packages", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
open("/usr/lib/python2.6/dist-packages", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
open("/usr/lib/python2.6/dist-packages/PIL.pth", O_RDONLY) = 4
open("/usr/lib/python2.6/dist-packages/pygst.pth", O_RDONLY) = 4
open("/usr/lib/python2.6/dist-packages/python-support.pth", O_RDONLY) = 4
open("/usr/lib/python2.6/dist-packages/wx.pth", O_RDONLY) = 4
open("/usr/lib/python2.6/dist-packages/zope.interface-3.5.3-nspkg.pth", O_RDONLY) = 4
open("/usr/lib/python2.6/sitecustomize.py", O_RDONLY) = 4
open("/usr/lib/python2.6/sitecustomize.pyc", O_RDONLY) = 5
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
open("/usr/lib/python2.6/encodings/__init__.py", O_RDONLY) = 3
open("/usr/lib/python2.6/encodings/__init__.pyc", O_RDONLY) = 4
open("/usr/lib/python2.6/codecs.py", O_RDONLY) = 4
open("/usr/lib/python2.6/codecs.pyc", O_RDONLY) = 5
open("/usr/lib/python2.6/encodings/aliases.py", O_RDONLY) = 4
open("/usr/lib/python2.6/encodings/aliases.pyc", O_RDONLY) = 5
open("/usr/lib/python2.6/encodings/utf_8.py", O_RDONLY) = 3
open("/usr/lib/python2.6/encodings/utf_8.pyc", O_RDONLY) = 4
Todos estos, al menos potencialmente, podrían tener un efecto en sys.path. Sin embargo, es extremadamente improbable que lo que viene antes de site.py
(todas sean bibliotecas e interfaces de sistema operativo no específicas de Python). Le sugiero que eche un vistazo a site.py
, sitecustomize.py
y los diversos archivos .pth
(su lista de archivos .pth
será diferente a la mía; eso es normal).
para averiguar cómo Django está cargando, compruebe la ruta: '>>> import Django Django >>> .__ path__ [ '/usr/local/lib/python2.6/ dist-packages/django '] ' – hughdbrown
Solo puedo ver el [' django ']. Tal vez es porque está instalado desde 'apt-get' – jaume