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:

  1. adding directory sys.path doesn't point actual modules.

  2. absence of __init__.py file in module directory.

  3. not having permissions view folders' contents or read enclosed files.

  4. problems python's string handling screwing path somehow (like not using raw mode , not adequately escaping backslashes when using windows paths containing backslashes.)

  5. something overwriting sys.path before import occurs.

  6. a typo.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -