[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] Setting python interpreter version on per-block or per-s

From: William Henney
Subject: Re: [O] [babel] Setting python interpreter version on per-block or per-subtree basis
Date: Fri, 25 Apr 2014 11:29:59 -0500

Dear Sacha, Ian, and Eric

Thanks very much for your replies.  Sacha's way is a clever idea and works fine, but I think Eric's patch is the best solution in the long term.  Please see attached test file - the patch works perfectly.  Although I did have to study the manual carefully to work out how get it to work using the #+call: syntax. The key is to use "inside header arguments".  Ian's solution with shebang works when tangling but not for direct evaluation of the source block.



On Fri, Apr 25, 2014 at 10:27 AM, Eric Schulte <address@hidden> wrote:
The attached patch should allow the specification of the python command
through a new :python header argument.  E.g.,

#+begin_src python :python /path/to/python2
  return 1 + 2

If someone who actually uses python could confirm that it works as
expected then I'll be happy to apply it.


William Henney <address@hidden> writes:

> Hi
> Is there an easy way to specify the python version to use for a particular
> block or sub-tree?
> My use case is that I have mainly migrated to python 3, but there is still
> the occasional library that has not been updated yet, so I need to fall
> back to python 2.7 for some tasks.
> I can work around the problem by putting the python 2 code in a separate
> org file and use
> # Local Variables:
> # org-babel-python-command: "/path/to/python2"
> # End:
> but keeping everything in the same file would be preferable.
> Thanks
> Will

Eric Schulte
PGP: 0x614CA05D


  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

Attachment: multi-python.org
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]