I have anaconda2 and anaconda3 installed on windows machine, have no access to internet and administrator rights. How can I switch between python 2 and 3 when starting jupyter? Basic "jupyter notebook" command starts python 2. With internet I would just add environment for python 3 and select it in jupyter notebook after start but how can I do this in this situation?
-
To switch between anaconda 2 and 3. Follow this link conda.pydata.org/docs/py2or3.html.Rangooski– Rangooski2016-10-20 09:53:42 +00:00Commented Oct 20, 2016 at 9:53
-
I red it. It requires internet connection and I haven't got it.BiXiC– BiXiC2016-10-20 10:22:19 +00:00Commented Oct 20, 2016 at 10:22
-
To switch from python 2 to python 3, type "activate python3" in terminal. Then pip install Jupyter. Then type ipython notebook.Rangooski– Rangooski2016-10-20 10:56:55 +00:00Commented Oct 20, 2016 at 10:56
-
could not find environment: python3BiXiC– BiXiC2016-10-20 11:09:46 +00:00Commented Oct 20, 2016 at 11:09
-
1You need to install a kernelspec for whichever version of Python you're not launching the notebook in. See the instructions here: ipython.readthedocs.io/en/stable/install/kernel_install.html . If you already have ipykernel in both versions, you can do this with no internet connection.Thomas K– Thomas K2016-10-20 15:37:10 +00:00Commented Oct 20, 2016 at 15:37
2 Answers
There's important points to consider:
- you have to have
jupyter notebookinstalled in each environment you want to run it from - if jupyter is only installed in one environment, your notebook will default to that environment no matter from which environment your start it, and you will have no option to change the notebook kernel (i.e. the conda package, and therefore which python version to use for your notebook)
You can list the packages in your environment with conda list. You can also check what environments exist with conda info --envs to make sure there's indeed one with python 3 (and use conda list to check it has jupyter installed).
From what you write, since your notebook defaults to python2, conda list should show you python 2 related packages.
So, as has been pointed, first activate the anaconda environment for python3 with the command activate your_python3_environment then restart your Notebook.
You don't need internet for this but you do need to be able to swap between anaconda2 and 3 (which you say are both installed) and both should have jupyter installed.