首页 > 其他 > 详细

juypyter notebook安装

时间:2020-08-25 18:50:12      阅读:114      评论:0      收藏:0      [点我收藏+]

Centos 8

Centos 8 云主机

Centos 8 云主机安全组暴露端口

云主机 添加安全组将juypyter端口暴露出去(端口与juypyter指定端口一直),通过公网ip加端口号进行访问

安装前环境

python版本3.6.8

[root@ecs-kc1-large-2-linux-20200825091713 ~]# python3
Python 3.6.8 (default, Nov 21 2019, 19:02:24) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

安装juypyter notebook

更新pip

使用清华源下载(未修改配置文件临时生效)-i https://pypi.tuna.tsinghua.edu.cn/simple

pip3 install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip



解决依赖

在准备安装python3和pip3时,请先安装依赖环境:yum install -y libffi-devel,和 yum -y install libxml2-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel 一定要先装!不然会出现如下例一连串连锁反应的bug

# wheel 本质上是一个zip 包格式,用于 python 模块的安装,它的出现是为了替代 Eggs
pip3 install wheel

# 如果不安装会报错:
#   Using legacy ‘setup.py install‘ for cffi, since package ‘wheel‘ is not installed.      (由于未安装软件包“ wheel”,因此将旧版“ setup.py install”用于cffi。)

# ---

yum -y install libffi-devel
# 如果不安装会报错(基本上就死这了):
# c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory

# ---


# python3以后版本使用加上版本号,否者python-devel
yum -y install python36-devel

# 如果不安装会报错:
#       c/_cffi_backend.c:2:10: fatal error: Python.h: No such file or directory      (c / _cffi_backend.c:2:10:致命错误:Python.h:无此类文件或目录)
#            error: command ‘gcc‘ failed with exit status 1      (错误:命令“ gcc”失败,退出状态为1)       排查:(通过在命令行键入gcc命令是存在的,是执行失败)
# 原因:系统中没有python.h的原因,是因为没有安装python的开发版,即Python-devel这个包

# ---



安装notebook

(官网安装使用的就是这个包)以然使用临时生效清华源下载 快

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple notebook

Jupyter Notebook 添加代码自动补全功能

如果之前安装过显示目录功能的话,这一步骤可以跳过

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple  jupyter_contrib_nbextensions

配置代码自动补全功能

安装完之后需要配置 nbextension,注意配置的时候要确保已关闭 Jupyter Notebook

jupyter contrib nbextension install --user --skip-running-check

启动 Jupyter Notebook

上面两个步骤都没报错后,启动 Jupyter Notebook,上面选项栏会出现 Nbextensions 的选项,点开 Nbextensions 的选项,并勾选 Hinterland, Jupyter Lab 中的自动补全功能, 按 Tab 键即可使用

# 设置Jupyter Notebook登陆密码
jupyter notebook  password


# ---

# 启动Jupyter Notebook
jupyter notebook  --ip=0.0.0.0   --no-browser --allow-root

# ---

# list    列出当前正在运行的笔记本服务器。
# password      设置笔记本服务器的密码。
# --port=      笔记本服务器将监听的端口(默认值:8888)
# --ip=            笔记本服务器将监听的IP地址。(0.0.0.0所有地址)
# --allow-root      不建议以root身份运行。 使用--allow-root绕过。
# --no-browser      启动后不要在浏览器中打开笔记本。
# 启动 Jupyter Notebook,勾选设置

关闭nftables防火墙

systemctl stop nftables

juypyter notebook安装

原文:https://www.cnblogs.com/hao-ran/p/13561213.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!