关于虚拟环境的创建及管理见我另一篇文章pyenv管理python环境

安装jupyter notebook

我的系统版本:Centos7.9
在所在虚拟环境内安装jupyter notebook,同时也会自动安装ipython

(lwj361) [python@lura ~/lwj/projects/cmdb]$pip install jupyter

安装成功提示:

修改jupyter notebook密码:

[python@lura ~/lwj/projects/cmdb]$jupyter notebook --help
[python@lura ~/lwj/projects/cmdb]$jupyter notebook password
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /home/python/.jupyter/jupyter_notebook_config.json

设置允许访问IP并启动jupyter notebook

[python@lura ~/lwj/projects/cmdb]$jupyter notebook --ip=0.0.0.0
ifconfig #查看localhost所在IP

使用 IP:8888 访问,然后输入你刚设置的密码即可

localhost端创建文件,在notwbook浏览器端都可以看到


将当前环境内所有的包 导出到一个文件内:pip freeze

(lwj361) [python@lura ~/lwj/projects/cmdb]$pip freeze > /tmp/requirement.txt
(lwj361) [python@lura ~/lwj/projects/cmdb]$cat /tmp/requirement.txt
argon2-cffi==21.1.0
async-generator==1.10
attrs==21.2.0
backcall==0.2.0
bleach==4.1.0
cffi==1.15.0
decorator==5.1.0
defusedxml==0.7.1
entrypoints==0.3
importlib-metadata==4.8.2
ipykernel==5.5.6
ipython==7.16.2
ipython-genutils==0.2.0
ipywidgets==7.6.5
jedi==0.17.2
Jinja2==3.0.3
jsonschema==4.0.0
jupyter==1.0.0
jupyter-client==7.1.0
jupyter-console==6.4.0
jupyter-core==4.9.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.2
MarkupSafe==2.0.1
mistune==0.8.4
........

这个文件保存下来,以后如果需要将同样的环境部署在别的项目里,直接 pip -r requirements.txt读取文件就可以

pip install -r requirement.txt

问题记录:

使用jupyter notebook 登陆时出现问题:

ImportError: cannot import name 'NoReturn'
[W 08:38:45.288 NotebookApp] KernelRestarter: restart failed
[W 08:38:45.288 NotebookApp] Kernel 429d9d0e-e748-4b1e-89ac-e1880c59b9b1 died, remo                                                            ving from map.
[W 08:39:27.239 NotebookApp] Timeout waiting for kernel_info reply from 429d9d0e-e7                                                            48-4b1e-89ac-e1880c59b9b1
[E 08:39:27.245 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does                                                             not exist: 429d9d0e-e748-4b1e-89ac-e1880c59b9b1)


在网上找了各种教程后发现是prompt-toolkit版本的问题
我根据提示将版本改为3.0.15就没有问题了,之前是3.0.19

pip install --upgrade prompt-toolkit==3.0.15
#卸载原来的版本
Attempting uninstall: prompt-toolkitFound existing installation: prompt-toolkit 3.0.19Uninstalling prompt-toolkit-3.0.19:Successfully uninstalled prompt-toolkit-3.0.19#安装3.0.15
[python@lura ~/lwj/projects/cmdb]$pip install --upgrade prompt-toolkit==3.0.15
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting prompt-toolkit==3.0.15Downloading https://mirrors.aliyun.com/pypi/packages/67/cc/5c44c8b3b3e9f9069eff81a9fc3                                                       54f417423558d394b4a9852c20b5ff164/prompt_toolkit-3.0.15-py3-none-any.whl (360 kB)|████████████████████████████████| 360 kB 1.4 MB/s
Requirement already satisfied: wcwidth in /home/python/.pyenv/versions/3.6.1/envs/lwj361                                                       /lib/python3.6/site-packages (from prompt-toolkit==3.0.15) (0.2.5)
Installing collected packages: prompt-toolkitAttempting uninstall: prompt-toolkitFound existing installation: prompt-toolkit 3.0.0Uninstalling prompt-toolkit-3.0.0:Successfully uninstalled prompt-toolkit-3.0.0
Successfully installed prompt-toolkit-3.0.15

可以看到现在使用

jupyter notebook --ip=0.0.0.0

进行连接就没有问题了

Linux下 jupyter notebook的使用相关推荐

  1. linux下jupyter notebook路径不对的解决方法

    在linux下,你在哪个目录下的终端上启动的jupyter notebook,你的默认路径就在哪里,所以会出现你导入的dataset出现找不到的情况,重新进入一下目录再开jupyter就行了

  2. Linux下 jupyter notebook 端口被占用解决办法

    找到占用端口 jupyter notebook list 查询端口 PID lsof -i :端口号 杀死程序 kill -9 PID

  3. 自定义notebook扩展插件_win10下jupyter notebook扩展插件安装失败

    notebook win10下jupyter notebook安装扩展插件nbextensions时,一开始提示没有权限,"erron,13"有一个json文件无法访问,后来找到c ...

  4. Linux Ubuntu下Jupyter Notebook的安装

    Jupyter Notebook, 以前又称为IPython notebook,是一个交互式笔记本, 支持运行40+种编程语言. 可以用来编写漂亮的交互式文档. 安装步骤: pip install - ...

  5. Windows下 jupyter notebook 运行multiprocessing 报错的问题与解决方法

    文章目录 测试用的代码 错误 解决方法 测试用的代码 下面每一个对应一个jupyter notebook的单元格 import time from multiprocessing import Pro ...

  6. 用windows浏览器打开Linux的Jupyter notebook开发、调试示例

    1.场景,在windows浏览器中打开Linux环境下的jupyter notebook.Jupyter notebook开启远程服务,Spark.python计算环境在Linux服务器中,而工作环境 ...

  7. Windows10下jupyter notebook无法打开,如何解决?

    Windows10下,安装anaconda带Jupyter notebook,不知不觉中无法打开,我两次遇到这种情况,解决办法是: 1)第一种错误 进入cmd:键入jupyter notebook,如 ...

  8. Windows 10下 jupyter notebook 安装,打开,使用,关闭方法

    jupyter notebook 可以在线运行Python,这个就够了 安装方法: 先安装Python3.5 然后:控制栏pip install jupyter 使用方法: 控制栏输入:jupyter ...

  9. Windows下jupyter notebook的安装和使用

    1.安装: (1)首先打开Windows命令终端: 输入命令:pip install jupyter notebook 慢慢等待安装完成就可以了 我的是已经是安装完成了 在命令行窗口中输入" ...

最新文章

  1. Hexo 个人博客 SEO 优化(3):改造你的博客,提升搜索引擎排名
  2. 「BATJ面试系列」并发编程
  3. Python 3.x print 小结
  4. Linux之数值运算:let,(()),[ ]
  5. Java面向对象概述
  6. pytorch之tensor按索引赋值,三种方法!
  7. 用户画像:数据指标与表结构设计
  8. 计算机网络学习笔记-1.1.3-速率相关的性能指标
  9. extras mibs php7,ubuntu编译安装php7遇到的问题及解决方案
  10. WPF基础(八)bitmapImage.EndInit()引发异常 未找到适用于完成此操作的图像处理组件:可能是收发图片格式不一致导致的。
  11. Spring5之IOC容器中IOC操作之Bean管理(二)之p名称空间注入、外部bean、内部bean、级联赋值
  12. [网络] 数字签名和数字证书的原理机制
  13. 简述敏捷团队,XP团队的特点。
  14. CAD点位坐标提取的方法
  15. 通过jenkins构建服务,并发布服务,修改Jenkins以Root用户运行
  16. SoftLayer VPS好吗?SoftLayer VPS机房优势有哪些
  17. Android计步器的实现(2)
  18. Oracle总结-学习这一篇就够了
  19. POJ3666 Making the Grade(DP)
  20. 不容错过的20亿像素珠穆朗玛峰图

热门文章

  1. kotlin——数组(增删改查)、haspMap(增删改查过滤)、for中断continue
  2. 前端发展历程,前端路由和后端路由,到底有什么区别?
  3. Android day_06 (ListView的入门使用 了解数据适配Adapter以及打气筒的使用)
  4. 根据物料序列号获取最新的HU号码_SAP刘梦_新浪博客
  5. influxdb常见操作
  6. Android基本布局和登录界面的设计
  7. mysql安装与卸载(非绿色版)
  8. 共享单车管理系统_长沙市首个共享单车管理及运维调度系统在天心区上线
  9. Karaf教程第2部分使用Configuration Admin服务
  10. 关系型和非关系型数据库的区别