Run another Julia with the same Pkg environment?

In my tests I run a script in another Julia run("julia myscript.jl") and my script starts with using Distributions which gives me a :

ERROR: LoadError: ArgumentError: Module Distributions not found in current path.

How can I make sure that my second Julia process uses the same environment as the main one ?

Thanks.

Start it in the same directory? If you use 0.7 or 1.0.

I think the issue was that my julia was referring to another version (I have like 5 installed). Otherwise I guess you could pass the path as an argument and activate it in the script.

You can use Base.julia_cmd() to spawn the same version.

1 Like