python - Use a module installed by another user -
i'm running python script on remote machine , asks pyfits
, technically installed on machine, python doesn't find it.
i've tried adding supposed directory it's installed in paths (i have access folder too) sys.path.append('folder')
method. still doesn't find it.
here's thought process illustrate:
the user installed modules has source @ "/otheruser/code/pyfits"
i've tried adding folder or folder pyfits
, init file (that have access to) in it, without success.
so main questions are:
should looking elsewhere module? should install modules again --myuser? or should mess site-packages? if 1 add module there?
according pyfits documentation, looks actual modules installed in lib/python
or possibly lib/python<version>/site-packages
(depending on flags used install) under top-level pyfits install directory. so, you'd want this:
sys.path.append(r'/otheruser/code/pyfits/lib/python') # might sys.path.append(r'/otheruser/code/pyfits/lib/python2.7/site-packages') # or similar import numpy import pyfits
if able read contents of directory appended , subdirectories, should go.
however, mentioned in comment on original question, might want edit question include actual code you're using this, since problem might easier guess way.
sources of difficulty might be:
adding directory sys.path doesn't point actual modules.
absence of
__init__.py
file in module directory.not having permissions view folders' contents or read enclosed files.
problems python's string handling screwing path somehow (like not using raw mode , not adequately escaping backslashes when using windows paths containing backslashes.)
something overwriting sys.path before import occurs.
a typo.
Comments
Post a Comment