Hi John,

Because PyCall links directly to the Python libraries, you have to rebuild 
it every time you want to use a different version of Python. That includes 
switching virtual environments. You do this by setting the environment 
variable PYTHON (ENV["PYTHON"] from within Julia) to the location of the 
python executable and then running Pkg.build("PyCall"). The process is 
pretty quick so you could probably write a function in your .juliarc.jl 
file to let you switch between environments. I haven't done this yet 
because I just use the root conda environment, but it's what I would do if 
I needed to switch between several.

Cheers,
Scott

On Saturday, 20 August 2016 00:53:47 UTC+1, John Hammonds wrote:
>
> I have been using Anaconda Python with their virtual environments.  I am 
> starting to look into Julia and would like to be able to use PyCall to call 
> in python code.  I am using the virtual environments to manage different 
> projects/versions.  My Base Python is fairly minimal, I install most 
> packages in the virtenvs,  When I use PyCall and @pyimport, I seem to only 
> find packages in my base anaconda installation.  Is there a clean way to 
> switch between different virtual environments when I am using Julia?
>
>

Reply via email to