关于Notebook环境的安装记录

这是Windows下的,由于自己用的miniconda,所以很多都是自己手动搞的。

1.

首先执行conda install jupyter notebook,它能创建一个jupyter notebook的快捷方式(当然你也可以自己创建这个快捷方式)。

2.

但是不习惯notebook7,而且插件什么的不想重新弄,所以还是用了notebook6,但是使用notebook6的时候其他依赖包版本又会冲突,各种冲突,我这里试出来一种可以用的,所以记录一下:

anyio==3.7.1
arrow==1.3.0
backcall==0.2.0
entrypoints==0.4
fqdn==1.5.1
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
ipykernel==6.29.4
ipython==7.25.0
ipython-genutils==0.2.0
isoduration==20.11.0
json5==0.9.25
jsonpointer==2.1
jsonschema-specifications==2023.12.1
jupyter-client==6.1.12
jupyter-console==6.0.0
jupyter-highlight-selected-word==0.2.0
jupyter-lsp==2.2.5
jupyter-server==1.21.0
jupyter_contrib_core==0.4.2
jupyter_nbextensions_configurator==0.6.4
jupyterlab==3.5.0
jupyterlab_server==2.27.2
lxml==5.2.2
mistune==3.0.2
nbclassic==0.5.6
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
notebook==6.4.0
pickleshare==0.7.5
prompt-toolkit==2.0.10
PyQt5==5.15.10
referencing==0.35.1
setuptools==69.5.1
simplegeneric==0.8.1
tomli==2.0.1
tornado==6.4.1
traitlets==5.9.0
types-python-dateutil==2.9.0.20240316
uri-template==1.3.0
wcwidth==0.2.13
webcolors==24.6.0
wheel==0.43.0

用的话就是创建到一个requirements.txt里,然后执行pip install -r requirements.txt安装一下就好了,如果打开了jupyter notebook,一定要先关闭,要不然很多原来高版本的依赖包删不干净,会导致出错

3.

找到jupyter notebook的快捷方式点击属性,在目标输入:

jupyter notebook

然后点击应用,它会自动重定向到:path\jupyter.exe notebook,如果它没有自动重定向,可能要自己找到jupyter.exe的路径改一下,然后就可以用了。

4.

内核需要搞一下:

添加内核首先进入到conda的某个环境里,执行下面的命令,安装本环境的IPython内核。show_name就是你想显示的名字。

python -m ipykernel install --user --name show_name
jupyter kernelspec install <kernel_path> #<kernel_path>是安装内核的具体路径

新环境如果没有安装ipykernel,先安装一下:pip install ipykernel 。(但是尽量别在装有jupyter notebook的环境中执行这个安装命令,会破坏依赖包的版本。

查看内核:

jupyter kernelspec list

删除内核:

jupyter kernelspec remove show_name

更改默认内核:
首先找到Jupyter配置文件:
Jupyter的配置文件通常位于用户的主目录下,名为 jupyter_notebook_config.py。
如果该文件不存在,你可以使用以下命令来生成它:jupyter notebook --generate-config

添加以下代码:

c.AsyncMultiKernelManager.default_kernel_name = 'your_kernel_name'

your_kernel_name替换为你想要设置为默认的内核名称。例如,如果你想要将base设置为默认内核,你应该使用:c.AsyncMultiKernelManager.default_kernel_name = 'base'
记得使用之前应该先创建名字为base的内核。

5.

设置为无密码:也是在Jupyter的配置文件中修改或者添加:c.NotebookApp.token = ''

6.

默认工作目录:
也是在Jupyter的配置文件中修改或者添加:

c.NotebookApp.notebook_dir = '你的路径'
  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值