spectralpython / spectral

Python module for hyperspectral image processing
MIT License
571 stars 139 forks source link

How to place a new directory in the SPECTRAL_DATA environment variable. #100

Closed Lovegood-1 closed 4 years ago

Lovegood-1 commented 4 years ago

When I run this code in python

`from spectral import *`
`img = open_image('92AV3C.lan')`

out: Unable to locate file "92AV3C.lan". If the file exists, use its full path or place its directory in the SPECTRAL_DATA environment variable.

So I want to ask how to place a new directory in the SPECTRAL_DATA environment variable.

tboggs commented 4 years ago

If you are on linux or Mac OS you can set it on the command line. If your data files are in /home/jdoe/data/, then you would just do

export SPECTRAL_DATA=/home/jdoe/data

before starting python from the same terminal. You can also put the command shown above in your .bashrc (or equivalent) so it is run every time you login. On Windows, you likely would need to set it in your registry.

If you don't want to set it from the command line or in your login script, you could set it from your python script like this:

import os
os.environ['SPECTRAL_DATA'] = '/home/jdoe/data`
emilharutyunyaNN commented 4 months ago

this doesn't help