[Top][All Lists]

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

Re: [O] Mixing Python2 and Python3 blocks in one file

From: William Henney
Subject: Re: [O] Mixing Python2 and Python3 blocks in one file
Date: Wed, 18 May 2016 22:37:33 -0500

Hi Ken,

On Wed, May 18, 2016 at 8:45 AM, Ken Mankoff <address@hidden> wrote:

On 2016-05-17 at 21:19, William Henney <address@hidden> 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

: ['', '/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 “source activate myenv” 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



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

reply via email to

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