"Loris Bennett" <loris.benn...@fu-berlin.de> writes:

> Hi,
>
> I have multiple versions of each of various languages such as Python
> or R.  On the command line I can select a version using the 'module'[1]
> mechanism provided by Lmod[2]:
>
> My question is: How do I change the environment, ideally call 'module
> load ...' but potentially just set environment variables, before calling
> a source block?

It depends on source block language.  For Python, there is :python
header arg where you can specify python command to be used.  I am not
sure about R

More generally, you can advice org-babel-execute-src-block and wrap it
into something like with-environment-variables macro (available in
newest Emacs).

Or you can write a bash source block, set envitonment there as usual,
and invoke your Python/R script using noweb.

Hope it helps.

Best,
Ihor

Reply via email to