Coding Interface: Jupyter Notebook
Official website: http://jupyter.org/
Using Anaconda installing Jupyter Notebook on Windows computer:
Anaconda:
Installation:
- Download Anaconda, official website: https://www.continuum.io/downloads or mirror from Tsing Hua university open software station: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
- Anaconda3 contains python 3.6, while Anaconda2 contains python 2.7.
- Please don’t use the install path with ’ ‘, such as “D:\Program Files\Anaconda3”, it will cause some error in future!
- Please choose “Add Anaconda to my PATH environment variable”.
Changing package source:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
Environment Management:
conda create -n python27 python=2.7 # install a new environment
conda info -e # Checking current environments
conda remove -n python27 --all # remove an environment
activate python27 # activate an environment on Windows
source activate python27 # activate an environment on Linux/Mac
deactivate python27 # deactivate an environment on Windows
source deactivate python # deactivate an environment on Linux/Mac
conda install -n python27 lxml # install a package for a paticulate environment
conda remove -n python27 lxml # uninstall a package from a paticulate environment
Jupyter notebook
Installation:
Anaconda3-4.4.0 has already install Jupyter Notebook for its default python environment python3.6
If you want to install Jupyter Notebook for an already existed environment, there has two ways:
- Install Anaconda scientific Computing packages for the environment, it will default install Jupyter Notebook
conda install -n python27 anaconda
- Install Jupyter Notebook noly:
conda install -n python27 ipykernel
If you want to create a new environment which has Jupyter Notebook:
conda create -n python27 python=2.7 ipykernel
In the same way, if you want the new created environment has more package, please add package names after python=x.x.
Add python2.7 kernel into Jupyter Notebook
activate python27 python -m ipykernel install --name=Python2.7 python -m ipykernel install --name=Python2.7 --user # add kernel option only to current user jupyter kernelspec list # list current kernels added in notebook jupyter kernelspec remove name_of_a_specific_kernel
How to start Notebook?
Start Notebook local server
jupyter nootbook # start with open a browser jupyter nootbook --no-browser # start without open a browser
Help Documents:
jupyter nootbook --help
Changing default local host port. The notebook server default starts on port 8888. If port 8888 is unavailable or in use, the notebook server searches the next available port.
jupyter nootbook --port 9999 # you can change the port number as your
Changing Default Working Space:
jupyter notebook --generate-config # create configure file, usually at C:/users/curent_user/.jupyter/jupyter_notebook_config.py
If system show that you have already has a configure file, don’t overwrite it!
Find this “jupyter_notebook_config.py” configure file, and changing the line:
# The directory to use for notebooks and kernels. # c.NotebookApp.notebook_dir = u''
As:
# The directory to use for notebooks and kernels. c.NotebookApp.notebook_dir = u'D:\Your\Jupypter\Workspace\Directory'
Similarly, you can also create ipython configure file:
ipython notebook --generate-config
Notebook Extension
There are many notebook extension package, you may need it:
conda install -c conda-forge jupyter_contrib_nbextensions
After install “jupyter_contrib_nbextensions”, you will find a new Label “Nbextension” on Notebook Home page.
You can choose your prefer extensions under this label.
Conda Extension on Jupyter Notebook:
Introduction pages: https://docs.continuum.io/anaconda/user-guide/tasks/use-jupyter-notebook-extensions
conda install nb_conda
This package will add a new Label “Conda” on Jupyter Notebook Home page. You can manage your environment and packages under this Laber.
You can edit your environment, notebook kernels and packages in this interface.
If you add “nb_conda ” package, it will add kernel choses in “new notebook”, and you can change the default kernel in the “Conda” interface.
It will also add “presentation” and “cloud” on each notebook’s edition pages.
Notice that, nb_cloud & nb_presentation only support on Windows 10. At lest it doesn’t work on my computer!