From mboxrd@z Thu Jan 1 00:00:00 1970 From: William Henney Subject: Re: Mixing Python2 and Python3 blocks in one file Date: Wed, 18 May 2016 22:37:33 -0500 Message-ID: References: <2016-05-08T10-21-00@devnull.Karl-Voit.at> <2016-05-17T16-45-38@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11396814cbc70f053329b175 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3EmF-00081U-CE for emacs-orgmode@gnu.org; Wed, 18 May 2016 23:37:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3EmE-0007Ln-7i for emacs-orgmode@gnu.org; Wed, 18 May 2016 23:37:35 -0400 Received: from mail-io0-x232.google.com ([2607:f8b0:4001:c06::232]:33262) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3EmE-0007Lb-18 for emacs-orgmode@gnu.org; Wed, 18 May 2016 23:37:34 -0400 Received: by mail-io0-x232.google.com with SMTP id f89so91309494ioi.0 for ; Wed, 18 May 2016 20:37:33 -0700 (PDT) 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" To: Ken Mankoff Cc: Karl Voit , emacs-org --001a11396814cbc70f053329b175 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Ken, On Wed, May 18, 2016 at 8:45 AM, Ken Mankoff wrote: On 2016-05-17 at 21:19, William Henney wrote: > > Why is the :python parameter insufficient for your needs? You can also > > use it for different virtual environments > > Can you clarify how to do this? Does it work with conda environments too? > Yes, you just have to specify ~/anaconda/envs/NAME_OF_ENV/bin/python as the name of the interpreter I gave a conda example in my first message to this thread, but here is another one. In the shell, I just made a new environment: $ condo create --name myenv And now, I can test it in an org file: #+BEGIN_SRC python :python ~/anaconda/envs/myenv/bin/python :results verbatim import sys return sys.path #+END_SRC #+RESULTS: : ['', '/Users/will/anaconda/envs/myenv/lib/python35.zip', '/Users/will/anaconda/envs/myenv/lib/python3.5', '/Users/will/anaconda/envs/myenv/lib/python3.5/plat-darwin', '/Users/will/anaconda/envs/myenv/lib/python3.5/lib-dynload', '/Users/will/anaconda/envs/myenv/lib/python3.5/site-packages', '/Users/will/anaconda/envs/myenv/lib/python3.5/site-packages/setuptools-20.= 7.0-py3.5.egg'] Note that this is not /exactly/ equivalent to doing =E2=80=9Csource activat= e myenv=E2=80=9D in a terminal shell since it does not run any activation/deactivation scripts that you might have put in the virtual environment. But personally I never use that feature Will --=20 Dr William Henney, Instituto de Radioastronom=C3=ADa y Astrof=C3=ADsica, Universidad Nacional Aut=C3=B3noma de M=C3=A9xico, Campus Morelia --001a11396814cbc70f053329b175 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Ken,

On Wed, May 18, 2016 at 8:45 AM= , Ken Mankoff=C2=A0<mankoff@gmail.com>=C2=A0wrote:

On 2016-05-17 at 21:19, William Henn= ey <whenney@gmail.com> wrote= :
> Why is the :python parameter insufficient for your needs? You can= also
> use it for different virtual environments

Can y= ou clarify how to do this? Does it work with conda environments too?

Yes, you just have to specify ~/anacond= a/envs/NAME_OF_ENV/bin/python as the name of the interpreter

=
I gave a conda example in my first message to this thread, but h= ere is another one.=C2=A0 In the shell, I just made a new environment:=C2= =A0

$=C2=A0condo create --name myenv
And now, I can test it in an org file:

#+BEGIN_SRC python :python ~/anaconda/envs/myenv/bin/python :results = verbatim
import sys
return sys.path
#+END_SRC=

#+RESULTS:
: ['', '/Users/w= ill/anaconda/envs/myenv/lib/python35.zip', '/Users/will/anaconda/en= vs/myenv/lib/python3.5', '/Users/will/anaconda/envs/myenv/lib/pytho= n3.5/plat-darwin', '/Users/will/anaconda/envs/myenv/lib/python3.5/l= ib-dynload', '/Users/will/anaconda/envs/myenv/lib/python3.5/site-pa= ckages', '/Users/will/anaconda/envs/myenv/lib/python3.5/site-packag= es/setuptools-20.7.0-py3.5.egg']

Note th= at this is not /exactly/ equivalent to doing =E2=80=9Csource activate myenv= =E2=80=9D in a terminal shell since it does not run any activation/deactiva= tion scripts that you might have put in the virtual environment.=C2=A0 But = personally I never use that feature

Will


--

=C2=A0 Dr William Henney, Institu= to de Radioastronom=C3=ADa y Astrof=C3=ADsica,
=C2=A0 Universidad Nacion= al Aut=C3=B3noma de M=C3=A9xico, Campus Morelia
--001a11396814cbc70f053329b175--