How to create modulefile on centos7 for any software (ex. for python)?
path of modulefile is /etc/modulefile
I have two version of python ( python2.7 and python3.7).
I Create a directory for python inside modulefiles /etc/modulefiles/python
, then I shoud create a modulefiles for paython as a following code :
#%Module 1.0
# python2.7 module file
conflict python
prepend-path PATH ---
prepend-path LD_LIBRARY_PATH ----
prepend-path MANPATH ---
prepend-path INFOPATH ---
setenv --_DIR ---
setenv --_BIN ---
setenv --_INC ---
setenv --_LIB ---
My question is how can I get the right variables of prepend-path
and setenv
Below is result of whereis python
command, can we extract varable of prepend-path
and setenv
from it:
[root@mu modulefiles]# whereis python
python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python2.7-config /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/local/bin/python3.7m-config /usr/local/bin/python3.7m /usr/local/bin/python3.7 /usr/local/lib/python3.7 /usr/include/python2.7 /etc/modulefiles/python /usr/share/man/man1/python.1.gz
The PATH
variable is the environment variable used to search for binaries.
You installed two different versions of Python, so each should have a different directory containing the python executable (bin
and probably also extra/bin
).
The LD_LIBRARY_PATH
is used to list the directories containing libraries. Probably lib
and extra/lib
, etc.
There are more environment variables that can be set, depending on the module you are trying to create. For instance, a gcc
module will probably set the CC
environment variable. Python can also have PYTHONPATH
where Python will look for modules and packages.
The MANPATH
environment variable is used to look for man
pages whereas the INFOPATH
is used to find Info manuals.
The variables that you need to set depend exclusively on what you actually want to use. It can be enough to just update PATH
and never update the MANPATH
properly, for example.