做视频网站代码,机关网站建设 方案,网站编辑工作,正邦设计公司招聘信息Jupyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本#xff0c;支持运行 40 多种编程语言。Jupyter Notebook 的本质是一个 Web 应用程序#xff0c;便于创建和共享文学化程序文档#xff0c;支持实时代码#xff0c;数学方程#xff0c;可视化和 markdown…Jupyter Notebook(此前被称为 IPython notebook)是一个交互式笔记本支持运行 40 多种编程语言。Jupyter Notebook 的本质是一个 Web 应用程序便于创建和共享文学化程序文档支持实时代码数学方程可视化和 markdown。 用途包括数据清理和转换数值模拟统计建模机器学习等等-------- 来至百度百科系统centos7centos7默认是python2依照官网进行安装# python -m pip install --upgrade pip# python -m pip install jupyter提示出错Downloadingsetuptools-40.4.3-py2.py3-none-any.whl (569kB)wheel-0.32.1-py2.py3-none-any.whlipython-7.0.1.tar.gz (5.1MB)Complete output from command python setup.py egg_info:IPython 7.0 supports Python 3.5 and above.When using Python 2.7, please install IPython 5.x LTS Long Term Support version.Python 3.3 and 3.4 were supported up to IPython 6.x.See IPython README.rst file for more information:https://github.com/ipython/ipython/blob/master/README.rstPython sys.version_info(major2, minor7, micro5, releaselevelfinal, serial0) detected.可以看到下载的ipython最少需要python3.3的支持编译python3安装依赖# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make备份# cd /usr/bin# mv python python.bak下载并编译# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz# tar -xvJf Python-3.6.2.tar.xz# cd Python-3.6.2# ./configure prefix/usr/local/python3# make make install# ln -s /usr/local/python3/bin/python3 /usr/bin/python验证同时存在python2和python3# python -VPython 3.6.2# python2 -VPython 2.7.5编辑yum和urlgrabber-ext-down执行yum需要python2需要修改yum的配置# vi /usr/bin/yum#! /usr/bin/python#! /usr/bin/python2# vi /usr/libexec/urlgrabber-ext-down#! /usr/bin/python#! /usr/bin/python2依照官网进行安装# python3 -m pip install --upgrade pip# python3 -m pip install jupyterSuccessfully installed MarkupSafe-1.0 Send2Trash-1.5.0 backcall-0.1.0 bleach-3.0.0 decorator-4.3.0 defusedxml-0.5.0 entrypoints-0.2.3 ipykernel-5.0.0 ipython-7.0.1 ipython-genutils-0.2.0 ipywidgets-7.4.2 jedi-0.13.1 jinja2-2.10 jsonschema-2.6.0 jupyter-1.0.0 jupyter-client-5.2.3 jupyter-console-6.0.0 jupyter-core-4.4.0 mistune-0.8.3 nbconvert-5.4.0 nbformat-4.4.0 notebook-5.7.0 pandocfilters-1.4.2 parso-0.3.1 pexpect-4.6.0 pickleshare-0.7.5 prometheus-client-0.4.0 prompt-toolkit-2.0.5 ptyprocess-0.6.0 pygments-2.2.0 python-dateutil-2.7.3 pyzmq-17.1.2 qtconsole-4.4.1 simplegeneric-0.8.1 six-1.11.0 terminado-0.8.1 testpath-0.4.2 tornado-5.1.1 traitlets-4.3.2 wcwidth-0.1.7 webencodings-0.5.1 widgetsnbextension-3.4.2生成配置文件# jupyter notebook --generate-configWriting default config to: /root/.jupyter/jupyter_notebook_config.py生成密码# python3Python 3.6.2 (default, Nov 2 2018, 16:17:04)[GCC 4.8.5 20150623 (Red Hat 4.8.5-28.0.1)] on linuxType help, copyright, credits or license for more information. from notebook.auth import passwd passwd()此时会让你两次输入密码然后就会生成秘钥修改配置文件# vi ~/.jupyter/jupyter_notebook_config.py# 设置所有IP皆可访问c.NotebookApp.ip 0.0.0.0c.NotebookApp.password u生成的密钥# 禁止自动打开浏览器c.NotebookApp.open_browser Flase# 服务端口c.NotebookApp.port 8080这里需要注意的是c.NotebookApp.ip这个配置项如果按照网上大多数的配置配置为*的话就会出现下面的错误# jupyter notebook[I 16:54:09.881 NotebookApp] Writing notebook server cookie secret to /run/user/13011/jupyter/notebook_cookie_secretTraceback (most recent call last):File /usr/local/lib/python3.6/site-packages/traitlets/traitlets.py, line 528, in getvalue obj._trait_values[self.name]KeyError: allow_remote_accessDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File /usr/local/lib/python3.6/site-packages/notebook/notebookapp.py, line 869, in _default_allow_remoteaddr ipaddress.ip_address(self.ip)File /usr/local/lib/python3.6/ipaddress.py, line 54, in ip_addressaddress)ValueError: does not appear to be an IPv4 or IPv6 addressDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File /usr/local/bin/jupyter-notebook, line 11, in sys.exit(main())File /usr/local/lib/python3.6/site-packages/jupyter_core/application.py, line 266, in launch_instancereturn super(JupyterApp, cls).launch_instance(argvargv, **kwargs)File /usr/local/lib/python3.6/site-packages/traitlets/config/application.py, line 657, in launch_instanceapp.initialize(argv)File , line 2, in initializeFile /usr/local/lib/python3.6/site-packages/traitlets/config/application.py, line 87, in catch_config_errorreturn method(app, *args, **kwargs)File /usr/local/lib/python3.6/site-packages/notebook/notebookapp.py, line 1629, in initializeself.init_webapp()File /usr/local/lib/python3.6/site-packages/notebook/notebookapp.py, line 1379, in init_webappself.jinja_environment_options,File /usr/local/lib/python3.6/site-packages/notebook/notebookapp.py, line 158, in __init__default_url, settings_overrides, jinja_env_options)File /usr/local/lib/python3.6/site-packages/notebook/notebookapp.py, line 251, in init_settingsallow_remote_accessjupyter_app.allow_remote_access,File /usr/local/lib/python3.6/site-packages/traitlets/traitlets.py, line 556, in __get__return self.get(obj, cls)File /usr/local/lib/python3.6/site-packages/traitlets/traitlets.py, line 535, in getvalue self._validate(obj, dynamic_default())File /usr/local/lib/python3.6/site-packages/notebook/notebookapp.py, line 872, in _default_allow_remotefor info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):File /usr/local/lib/python3.6/socket.py, line 743, in getaddrinfofor res in _socket.getaddrinfo(host, port, family, type, proto, flags):socket.gaierror: [Errno -2] Name or service not known需要注意版本信息如果notebook为5.6.0以下版本,c.NotebookApp.ip *为以上版本则设置为c.NotebookApp.ip 0.0.0.0启动服务# jupyter notebook[C 17:02:44.143 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.根据提示使用root用户启动需要加入参数# jupyter notebook --allow-root[I 17:04:12.761 NotebookApp] Serving notebooks from local directory: /home/sphuser/Python-3.6.2[I 17:04:12.761 NotebookApp] The Jupyter Notebook is running at:[I 17:04:12.761 NotebookApp] http://(jupyterserver or 127.0.0.1):8080/[I 17:04:12.761 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).打开 IP:指定的端口, 输入密码就可以访问了参考文档http://jupyter.org/install.htmlhttps://www.cnblogs.com/JahanGu/p/7452527.htmlhttps://blog.csdn.net/qq_18293213/article/details/72910834https://my.oschina.net/mengyoufengyu/blog/2252687