问题
I am encountering package compatibility issues within my global Julia environment for specific packages I want to use in a Jupyter notebook. Is there a way to tell IJulia to use a different environment instead of my global one?
回答1:
The default IJulia kernel sets --project=@. so the most convenient way (IMO) is to just keep your project in the same folder as the notebook. The result is that the correct project is used from the start and you don't have to worry about activating it while in the notebook.
回答2:
You can always start up a notebook, and within a cell run
using Pkg
Pkg.activate("./path/to/folder")
回答3:
When starting the notebook type:
notebook(dir="/path/to/your/environment/")
This will launch Jupyter notebook loading the environment (Project.toml) in the directory that you have specified. If there is no Project.toml in that directory, the default (global) environment will be used.
回答4:
Depending on the complexity of your setup, you might want to consider Lmod I use this with a module hierarchy: 1. Core module, 2. Compiler modules, MPI modules. With this, its possible to quickly switch between difference branches.
来源:https://stackoverflow.com/questions/60406075/how-to-set-julia-environment-for-ijulia-jupyter-notebook