Show More
@@ -1,53 +1,55 b'' | |||||
1 | .. _kernel_install: |
|
1 | .. _kernel_install: | |
2 |
|
2 | |||
3 | Installing the IPython kernel |
|
3 | Installing the IPython kernel | |
4 | ============================= |
|
4 | ============================= | |
5 |
|
5 | |||
6 | .. seealso:: |
|
6 | .. seealso:: | |
7 |
|
7 | |||
8 | :ref:`Installing Jupyter <jupyter:install>` |
|
8 | :ref:`Installing Jupyter <jupyter:install>` | |
9 | The IPython kernel is the Python execution backend for Jupyter. |
|
9 | The IPython kernel is the Python execution backend for Jupyter. | |
10 |
|
10 | |||
11 | The Jupyter Notebook and other frontends automatically ensure that the IPython kernel is available. |
|
11 | The Jupyter Notebook and other frontends automatically ensure that the IPython kernel is available. | |
12 | However, if you want to use a kernel with a different version of Python, or in a virtualenv or conda environment, |
|
12 | However, if you want to use a kernel with a different version of Python, or in a virtualenv or conda environment, | |
13 | you'll need to install that manually. |
|
13 | you'll need to install that manually. | |
14 |
|
14 | |||
15 | Kernels for Python 2 and 3 |
|
15 | Kernels for Python 2 and 3 | |
16 | -------------------------- |
|
16 | -------------------------- | |
17 |
|
17 | |||
18 | If you're running Jupyter on Python 3, you can set up a Python 2 kernel like this:: |
|
18 | If you're running Jupyter on Python 3, you can set up a Python 2 kernel like this:: | |
19 |
|
19 | |||
20 | python2 -m pip install ipykernel |
|
20 | python2 -m pip install ipykernel | |
21 | python2 -m ipykernel install --user |
|
21 | python2 -m ipykernel install --user | |
22 |
|
22 | |||
23 | Or using conda, create a Python 2 environment:: |
|
23 | Or using conda, create a Python 2 environment:: | |
24 |
|
24 | |||
25 | conda create -n ipykernel_py2 python=2 ipykernel |
|
25 | conda create -n ipykernel_py2 python=2 ipykernel | |
26 | source activate ipykernel_py2 # On Windows, remove the word 'source' |
|
26 | source activate ipykernel_py2 # On Windows, remove the word 'source' | |
27 | python -m ipykernel install --user |
|
27 | python -m ipykernel install --user | |
28 |
|
28 | |||
29 | If you're running Jupyter on Python 2 and want to set up a Python 3 kernel, |
|
29 | If you're running Jupyter on Python 2 and want to set up a Python 3 kernel, | |
30 | follow the same steps, replacing ``2`` with ``3``. |
|
30 | follow the same steps, replacing ``2`` with ``3``. | |
31 |
|
31 | |||
32 | The last command installs a :ref:`kernel spec <jupyterclient:kernelspecs>` file |
|
32 | The last command installs a :ref:`kernel spec <jupyterclient:kernelspecs>` file | |
33 | for the current python installation. Kernel spec files are JSON files, which |
|
33 | for the current python installation. Kernel spec files are JSON files, which | |
34 | can be viewed and changed with a normal text editor. |
|
34 | can be viewed and changed with a normal text editor. | |
35 |
|
35 | |||
36 | .. _multiple_kernel_install: |
|
36 | .. _multiple_kernel_install: | |
37 |
|
37 | |||
38 | Kernels for different environments |
|
38 | Kernels for different environments | |
39 | ---------------------------------- |
|
39 | ---------------------------------- | |
40 |
|
40 | |||
41 | If you want to have multiple IPython kernels for different virtualenvs or conda environments, |
|
41 | If you want to have multiple IPython kernels for different virtualenvs or conda environments, | |
42 |
you will need to specify unique names for the kernelspecs |
|
42 | you will need to specify unique names for the kernelspecs. | |
|
43 | ||||
|
44 | For example, using conda environments: | |||
43 |
|
45 | |||
44 | .. sourcecode:: bash |
|
46 | .. sourcecode:: bash | |
45 |
|
47 | |||
46 | source activate myenv |
|
48 | source activate myenv | |
47 | python -m ipykernel install --user --name myenv --display-name "Python (myenv)" |
|
49 | python -m ipykernel install --user --name myenv --display-name "Python (myenv)" | |
48 | source activate other-env |
|
50 | source activate other-env | |
49 | python -m ipykernel install --user --name other-env --display-name "Python (other-env)" |
|
51 | python -m ipykernel install --user --name other-env --display-name "Python (other-env)" | |
50 |
|
52 | |||
51 | The ``--name`` value is used by Jupyter internally. These commands will overwrite |
|
53 | The ``--name`` value is used by Jupyter internally. These commands will overwrite | |
52 | any existing kernel with the same name. ``--display-name`` is what you see in |
|
54 | any existing kernel with the same name. ``--display-name`` is what you see in | |
53 | the notebook menus. |
|
55 | the notebook menus. |
General Comments 0
You need to be logged in to leave comments.
Login now