My Jupyter
notebooks installed with python 2
kernel. I do not understand why. I might have messed something up when I did the install. I already have python 3
installed. How can I add it to Jupyter
?
Here's a screenshot of what the default Jupyter
insalled with python3 -m install jupyter
and opened in the browser with jupyter notebook
looks like:
相关问题
- Access IPython's profile history (history.sqli
- Requests.get showing different HTML than Chrome
- tf.enable_eager_execution must be called at progra
- ipywidgets widgets values not changing
- Pandas and NumPy default width change on startup
相关文章
- cython in jupyter notebook
- python: ignoring leading “>>>” and “…” in interact
- Pyspark error: Java gateway process exited before
- Vim key map in jupyter notebook
- how to print source code of object I defined use
- IPython won't start
- How can the terminal in Jupyter automatically run
- Jupyter Notebook doesn't show new environments
I had Python 2.7 and wanted to be able to switch to Python 3 inside of Jupyter.
These steps worked for me on a Windows Anaconda Command Prompt:
Now after opening ipython notebook with the usual command for Python2.7, Python3.3 is also available when creating a new notebook.
If you are using the anaconda distribution, this worked for me (on a macintosh):
Just a note for the last command:
As tested in OSX Yosemite with the above steps and entering
jupter notebook
and creating a new notebook in the browser you will see the following screenshot:For the current Python Launcher
If you have Py3 installed but default to py2
If you have Py2 installed but default to py3
open terminal(or cmd for window), then run following commands: (On window, drop "source" in the second line.)
I tried some method but It doesnt work, then I found this way. It worked with me. Hoping it can help.
Here's a Windows/non command line method I found, which worked for me: Find the folder where the kernel files are stored (on my machine - C:\ProgramData\jupyter\kernels - note that ProgramData is a hidden folder), create a copy of the existing kernel's folder, change the name and edit the json file within to point to the new kernel's directory. In this json you can also edit the kernel name that is displayed in ipython (e.g. instead of just python 2 you can specify 2.7.9 if you need to further distinguish for some reason).
for recent versions of jupyter/ipython: use
jupyter kernelspec
list current kernels
In my case, the python3 kernel setup was broken because the py3.5 linked was no longer there, replaced by a py3.6
add/remove kernels
Remove:
Add a new one:
To find out the folder, you might use
which PYTHON
egwhich python3.6
(orpyenv which python3.6
if you are using pyenv!). Thenwill show you where the executable is.
List again:
Doc: https://jupyter-client.readthedocs.io/en/latest/kernels.html#kernelspecs
Details
Kernels available are listed under the
kernels
folder in Jupyter DATA DIRECTORY (see http://jupyter.readthedocs.io/en/latest/projects/jupyter-directories.html for details).For instance on macosx that would be
/Users/YOURUSERNAME/Library/Jupyter/kernels/
the kernel is simply described by a
kernel.json
file, eg. for/Users/me/Library/Jupyter/kernels/python3/kernel.json
Rather then manipulating that by hand, you can use the
kernelspec
command (as above). It was previously available through ipython now through jupyter (http://ipython.readthedocs.io/en/stable/install/kernel_install.html#kernels-for-different-environments - https://jupyter-client.readthedocs.io/en/latest/kernels.html#kernelspecs).Kernels for other languages
By the way, not strictly related to this question but there's a lot of other kernels available... https://github.com/jupyter/jupyter/wiki/Jupyter-kernels