We have a number of different versions of python which we module load
. These can be a vanilla python 2 or 3 install, or an anaconda version with a whole load of extra libraries.
At the moment, if I write a script which requires me to use a specific python install (which I find using module load python/ana ; which python
), I have to #!
to an explicit path. For example
#!/path/to/anaconda/1.7.0/64/bin/python
points to the current version of python which is loaded when I do module load python/anaconda
at the moment.
This module is not managed by me however, so if someone updates the module to use /path/to/anaconda/1.7.1/64/bin/python
then deletes 1.7.0, my script will stop working.
Is there a standard way for a script to specify both the interpreter to use and the module the interpreter should be loaded from? Something like
#!/blah/module_env python/anaconda python -c
Alternatively, are there any other options which don't need root access? Our enterprise linux machines are locked down so that we can't install our own software, or change /use/bin/env
configuration, just module load
software which has been made available.
module spider python
to see what versions of python you have available? You can also typewhich python
and use that path as the shebang line.python
in the first place @BarocliniCplusplus. I've edited my question to make that clear. Also, we are using standard environment modules, not an alternative implementation such as Lmod as implied by yourmodule spider
reference.