博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos6 python3.6 安装配置jupyer
阅读量:2156 次
发布时间:2019-05-01

本文共 3033 字,大约阅读时间需要 10 分钟。

1、安装

1.1、安装python3.6

参考:https://blog.csdn.net/kyle0349/article/details/98474013

编译安装前一定要yum 安装一些linux相关的依赖。

1.2、安装jupyter

安装完后, jupyter并没有配置到环境变量中,也就是不能直接在命令行使用jupyter,可以在python安装目录bin下面找到,然后创建一个软连接

[root@cdh01 ~]# pip3 install jupyter[root@cdh01 python36]# ln -s /usr/local/python36/bin/jupyter /usr/bin/jupyter[root@cdh01 python36]# ln -s /usr/local/python36/bin/jupyter-notebook /usr/bin/jupyter-notebook[root@cdh01 python36]# jupyterusage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]               [--paths] [--json]               [subcommand]jupyter: error: one of the arguments --version subcommand --config-dir --data-dir --runtime-dir --paths is required

2、配置

2.1、设置jupyter登录密码

进入python3命令行,import jupyter 的notebook passwd方法

让你两次输入密码,自动生成秘钥, 记住密钥,后续用到

[root@cdh01 ~]# python3Python 3.6.9 (default, Aug 25 2019, 12:13:26) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> from notebook.auth import passwd>>> passwd()Enter password: Verify password: 'sha1:4q1qwefwed22asdadjhgfsdaasddadsqeaafadadadec688'>>>

2.2、生成jupyter的配置文件

如下,使用 jupyter notebook --generate-config 会在root用户目录下创建一个jupyter的配置文件【jupyter_notebook_config.py】

[root@cdh01 python36]# bin/jupyter notebook --generate-configWriting default config to: /root/.jupyter/jupyter_notebook_config.py

2.3、修改jupyter配置文件

常见修改以下几个属性

# 设置所有ip皆可访问,默认只能本地可以访问。#c.NotebookApp.ip = 'localhost'c.NotebookApp.ip='0.0.0.0'         # 这里使用上面设置的密钥#c.NotebookApp.password = ''c.NotebookApp.password = 'sha1:4q1qwefwed22asdadjhgfsdaasddadsqeaafadadadec688'     # 在linux上安装,把自动打开浏览器关闭#c.NotebookApp.open_browser = Truec.NotebookApp.open_browser = False      #指定一个端口   默认c.NotebookApp.port = 8888# 指定工作目录,新建的文件都会保存到这个目录下               #c.NotebookApp.notebook_dir = ''        c.NotebookApp.notebook_dir = '/opt/jupyter/notebook'

3、启动&关闭

正常启动

[root@cdh01 python36]# jupyter notebook --allow-root[I 13:15:05.748 NotebookApp] 把notebook 服务cookie密码写入 /root/.local/share/jupyter/runtime/notebook_cookie_secret[I 13:15:06.142 NotebookApp] 端口 8888 已经被站用, 请尝试其他端口.[I 13:15:06.142 NotebookApp] 端口 8889 已经被站用, 请尝试其他端口.[I 13:15:06.149 NotebookApp] 启动notebooks 在本地路径: /opt/jupyter/notebook[I 13:15:06.149 NotebookApp] 本程序运行在: http://cdh01:8890/[I 13:15:06.149 NotebookApp] 使用control-c停止此服务器并关闭所有内核(两次跳过确认).^C[I 13:15:31.240 NotebookApp] 中断启动notebooks 在本地路径: /opt/jupyter/notebook0 活跃的服务本程序运行在: http://cdh01:8890/关闭服务 (y/[n])y[C 13:15:32.470 NotebookApp] 关闭确定[I 13:15:32.471 NotebookApp] 关闭 0 服务

后台运行

[root@cdh01 python36]# nohup jupyter notebook --allow-root >> /opt/jupyter/logs/notebook.log &[1] 59807[root@cdh01 python36]# nohup: 忽略输入重定向错误到标准输出端[root@cdh01 python36]# [root@cdh01 python36]# [root@cdh01 python36]# ps -ef | grep jupyterroot      59807  57657 13 13:17 pts/2    00:00:01 /usr/local/python36/bin/python3.6 /usr/local/python36/bin/jupyter-notebook --allow-rootroot      59829  57657  0 13:17 pts/2    00:00:00 grep jupyter[root@cdh01 python36]#

4、登录

用前面自己设置的密码登录 http://192.168.2.100:8888/login

在这里插入图片描述
在这里插入图片描述

你可能感兴趣的文章
PHPstudy中遇到的坑No input file specified,以及传到linux环境下遇到的坑,模板文件不存在
查看>>
TP5.1事务操作和TP5事务回滚操作多表
查看>>
composer install或composer update 或 composer require phpoffice/phpexcel 失败解决办法
查看>>
TP5.1项目从windows的Apache服务迁移到linux的Nginx服务需要注意几点。
查看>>
win10安装软件 打开时报错 找不到 msvcp120.dll
查看>>
PHPunit+Xdebug代码覆盖率以及遇到的问题汇总
查看>>
PHPUnit安装及使用
查看>>
PHP项目用xhprof性能分析(安装及应用实例)
查看>>
composer安装YII
查看>>
Sublime text3快捷键演示
查看>>
sublime text3 快捷键修改
查看>>
关于PHP几点建议
查看>>
硬盘的接口、协议
查看>>
VLAN与子网划分区别
查看>>
Cisco Packet Tracer教程
查看>>
02. 交换机的基本配置和管理
查看>>
03. 交换机的Telnet远程登陆配置
查看>>
微信小程序-调用-腾讯视频-解决方案
查看>>
phpStudy安装yaf扩展
查看>>
密码 加密 加盐 常用操作记录
查看>>