首页 > 系统相关 >Centos7 搭建Jupyter NoteBook教程

Centos7 搭建Jupyter NoteBook教程

时间:2022-11-28 21:00:59浏览次数:53  
标签:虚拟环境 Jupyter -- 防火墙 Centos7 NoteBook conda NotebookApp root

(目录)

以下操作基于root用户

1. Anaconda3

1.1 下载

wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh

1.2 安装

bash Anaconda3-5.0.1-Linux-x86_64.sh

在这里插入图片描述

2. 环境配置

2.1 添加PATH到/root/.bashrc文件中

vim /root/.bashrc
export PATH="/root/anaconda3/bin:$PATH"

在这里插入图片描述

2.2 激活配置的环境变量

source ~/.bashrc

验证结果

conda -V

在这里插入图片描述

3. 搭建虚拟环境

3.1 创建虚拟环境

conda create -n python2.7.5 python=2.7.5

conda基础命令 conda create -n name python=x.x conda update -n base conda //update最新版本的conda conda create -n xxxx python=3.6 //创建python3.6的xxxx虚拟环境 conda activate xxxx //开启xxxx环境 conda deactivate //关闭环境 conda env list //显示所有的虚拟环境 conda remove -n xxxx --all //删除虚拟环境,删除已创建的xxxx虚拟环境

3.2 开启环境

 source activate python2.7.5

在这里插入图片描述

3.3 查看已有的虚拟环境

conda env list

在这里插入图片描述

4. jupyter配置

4.1 生成配置文件

jupyter notebook --generate-config --allow-root

4.2 设置密码获得秘钥

1.进入 ipython

ipython

2.引包

In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:

3.得到秘钥

Out[2]: 'sha1:5d8d5d6ea2a5:04a*************************3c24b7280b67'

4.退出

In [3]: exit()

4.3 修改配置文件内容

vim /root/.jupyter/jupyter_notebook_config.py
# 对外提供访问的ip
c.NotebookApp.ip = '虚拟机的ip地址'
# 对外提供访问的端口
c.NotebookApp.port = 7777
# 启动不打开浏览器
c.NotebookApp.open_browser = False
# 上面生成的秘钥
c.NotebookApp.password = 'sha1:5d8d5d6ea2a5:04a*************************3c24b7280b67'
# 设置jupyter启动后默认文件夹
c.NotebookApp.notebook_dir = '/root'
# 允许root用户执行
c.NotebookApp.allow_root = True

5. 后台启动服务

5.1 正常启动

jupyter notebook --allow-root &

Ctrl+c可以切出进程 在这里插入图片描述 打开给出的网址即可 http://10.100.12.135:7777/

在这里插入图片描述

6. 问题:虚拟机能运行,本机却不行?

  • 原因:Centos防火墙拦截了端口
  • 解决方法2选1

6.1 关闭Centos防火墙

查看防火墙状态

systemctl status firewalld.service

看到绿色字样标注的active(running),说明防火墙是开启状态 在这里插入图片描述 停止防火墙

systemctl stop firewalld

6.2 如果不关闭防火墙,则开放端口

查看已开放的端口

firewall-cmd --list-ports

开放端口(上面配置的端口)

firewall-cmd --zone=public --add-port=7777/tcp --permanent

重启防火墙

firewall-cmd --reload

解决 在这里插入图片描述

标签:虚拟环境,Jupyter,--,防火墙,Centos7,NoteBook,conda,NotebookApp,root
From: https://blog.51cto.com/yeatsliao/5890872

相关文章

  • CentOS7 部署Greenplum6
    环境准备3个节点,每个节点8核、32G内存、1TB硬盘对应ip和角色划分为:#主master192.168.31.101gp1#从master,4个主segment4个从segment192.168.31.102gp2#4个主segm......
  • Centos7.X下Docker环境安装并配置加速镜像
    1、安装yuminstall-ydocker2、开启Docker服务systemctlstartdocker.service3、查看安装版本dockerversion4、设置开机启动systemctlenabledocker.servi......
  • Linux实验2:CENTOS7下的用户管理和权限设置
    一、实验目的掌握创建用户和用户组的方法;掌握文件的权限设置方法。二、实验任务1.新增加一个组名为student,密码为123。2.新增加一个用户名为zhouxingchi,其附属组......
  • centos7 部署Prometheus
    前言:一、前置环境说明1、关闭firewallsystemctlstopfirewalld.servicesystemctldisablefirewalld.service2、关闭selinuxvim/etc/selinux/configSELINUX=disa......
  • Jupyter 快捷键
    命令模式(按键Esc开启)Enter :转入编辑模式Shift-Enter :运行本单元,选中下个单元Ctrl-Enter :运行本单元Alt-Enter :运行本单元,在其下插入新单元......
  • OS + Centos7 LDAP / centos8 ldap
    s环境cents8.6,软件ldap2.4.46[root@scts08tldap]#yumlist*ldap*Lastmetadataexpirationcheck:2:30:54agoonMon28Nov202201:25:57AMPST.Installed......
  • Centos7下redis5安装、部署、开机自启
    不知道为何,使用centos7安装redis4.0以上版本的yum源一直找不到,官网也没有,具体原因没有去调查,所以这里使用源码安装做个记录 1.由于Redis是用C语言编写,所以编译......
  • Centos7 yum 安装mysql8.0
    1.去mysql官网下载yum存储库包https://dev.mysql.com/downloads/repo/yum/  这里本人很早之前就下载过,就不重复下载了 2.安装mysqlyum......
  • Centos7 yum 安装php74
    1.安装remi扩展源remi源是Remirepository是包含最新版本PHP和MySQL包的Linux源,由Remi提供维护。有个这个源之后,使用YUM安装或更新PHP、MySQL、phpMy......
  • Centos7安装与使用
    1.问题描述在Windows下,使用VMware安装Centos72.版本介绍Centos镜像列表:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS7版本说明大小CentO......