How to change the default JULIA_NUM_THREADS variable? How to call a multi thread julia from a python script?

Hello everyone,

Is there a way to change the DEFAULT number of threads (default is 1) so that every time I use julia.exe it always starts with 4 threads?

I know we could manually set it by

set JULIA_NUM_THREADS = 4 and then run Julia,

but I can not do that because I am using pyjulia and I want to call a multi-threading julia script from a python script.

So I am thinking of two potential solutions

(1) change the default JULIA_NUM_THREADS so it starts with multi threads

(2) specify the number of threads in python while using pyjulia (have no idea how to do it).

Any thoughts or suggestions? Thank you!

Try setting the environment variable via Python: