Jupyter notebook only works in base environment

2019-07-21 06:34发布

问题:

Jupyter notebook stopped working as usual suddenly today.

If I launch Jupyter like this then everything works fine in base environment.

activate base
jupyter notebook

But launching it in any other environment or simply without declaring environment

activate XXX
jupyter notebook

results as a localhost:8889/tree blank page in browser.

Also there are no errors in Jupyter console.

I have reinstalled Anaconda and Jupyter, restarted PC and used ip 127.0.0.1 instead of localhost, but nothing helps.

What should I do? I really need to get environments back up fast.

回答1:

Once you activate your conda environment, try to install Jupyter for that environment:

conda activate XXX conda install -c anaconda jupyter

Hope it helps.



回答2:

A better way is to have one Jupyter with multiple kernels depending on your environment:

So all you need is:

conda activate my_env
(my_env) conda install ipykernel -y
(my_env) python -m ipykernel install --user --name my_env --display-name "My Env"
(my_env) conda deactivate

Now you can open Jupyter and you will see “My Env” as a possible kernel. ;)

See: Anaconda Documentation