From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Barton Subject: Re: [babel] Setting python interpreter version on per-block or per-subtree basis Date: Fri, 25 Apr 2014 10:00:57 +0100 Message-ID: <535A2449.6030603@wilkesley.net> References: Reply-To: ian@manor-farm.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wdc0N-000873-LZ for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 05:01:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wdc0G-0002uJ-TA for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 05:01:11 -0400 Received: from mail2.wilkesley.net ([109.74.196.44]:47048 helo=li40-130.members.linode.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wdc0G-0002uB-Ns for emacs-orgmode@gnu.org; Fri, 25 Apr 2014 05:01:04 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: William Henney , emacs-org > 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: > I think you can use shebang for this. It definitely works for tangling files: #+begin_src python :shebang #!/usr/bin/python2 :tangle ./raspberrypi/weather.py :exports none :noweb yes #+end_src