Used to use python notebook Editor under windows, today I want to install a notebook under linux.

There are two versions of Python, Python 2.7 and python 3.5 in the linux system.

If you have other versions of python installed, you can enter where is python from the command line to see the version and location.

The default state on my computer is to start Python 2.7. Whether you are all like this remains to be verified.

I. Installation

Enter pip install jupyter -- user at the terminal.

Potential problems: slow download speed and timeout

Solution: Using Domestic Mirrors

pip install some_package --index https://pypi.mirrors.ustc.edu.cn/simple/

Here some_package can be any third-party class library name, using the Tsinghua image. Four other mirrors can also be used:

Aliyun http://mirrors.aliyun.com/pypi/simple/
China University of Science and Technology https://pypi.mirrors.ustc.edu.cn/simple/
Douban http://pypi.douban.com/simple/
China University of Science and Technology http://pypi.mirrors.ustc.edu.cn/simple/

II. Start-up

Terminal input jupyter notebook

Possible problems:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 89, in catch_config_error
    app.print_help()
  File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 385, in print_help
    self.print_subcommands()
  File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 377, in print_subcommands
    print(os.linesep.join(lines))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128)

Solution: 1. Some people say that the wrong file should be added at the beginning.

importsys
reload(sys)
# sys.setdefaultencoding('utf8')

It can be solved, but I tried. It didn't work. You can try.

Or add

importsys
reload(sys)
#sys.setdefaultencoding('utf8')
sys.setdefaultencoding('gb18030')

2. After the terminal input: LANGUAGE=en_US, enter jupyter notebook

I solved the problem by way 2.

3. Install both Python 2 and python 3 notebook

Terminal input sudo apt install Python 3-pip, install PIP for Python 3

Enter pip3 install jupyter --user, install Python 3 notebook, -- user can take or not.

Note: PIP3 install package name

Represents global installation, which is available after installation. If it is a trusted installation package, you can use this command to install it.

pip3 install --user packagename

Represents the installation of only that user, and only that user is available after installation. For security reasons, try to use this command for installation.

When notebook is started, the following figure shows that the two versions have been successfully installed.