admin管理员组

文章数量:1666601

1,下载miniforge3

GitHub - conda-forge/miniforge: A conda-forge distribution.

下载下来后傻瓜式安装就可以了

配置环境变量,在系统环境变量的path添加下列就行了,根据自己的路径修改

2,创建虚拟环境

conda create -n test python=3.10

(不知道python版本,可以用python --version打印出来就知道了)

conda init   (初始化conda配置,它会在shell配置文件添加conda激活逻辑)

3,安装jupyter-lab

建议进入虚拟环境下执行

pip install jupyter-lab

生成并配置jupyterlab文件
jupyter lab --generate-config

执行上述命令后会返回一个upyter_lab_config.py的文件路径,复制路径找到文件进行下列配置


配置文件内容修改如下
c = get_config() #noqa
c.ServerApp.root_dir = '/soft/python-project' # 工作路径
c.ServerApp.allow_remote_access = True
c.ServerApp.ip = '*'
c.LabApp.open_browser = False
c.ServerApp.port = 8701
c.ServerApp.iopub_data_rate_limit = 1.0e10

4,将虚拟环境设置到jupyter-lab上生效

conda install ipykernel

python -m ipykernel install --user --name 自己虚拟环境名 --display-name "jupyter自定义名字"

jupyter-lab  --allow-root

(执行完这个命令会弹出一段文字,里面有两个url,可以登录页面版的jupyter notebook

 http://localhost:8701/lab?token=026e943b886e2826aebf4f64d1ffee8c320594b010d711f5

)

5,常用的一些命令

conda env list  查看有哪些虚拟环境

conda activate test   激活test虚拟环境

deactivate test 关闭test虚拟环境

jupyter kernelspec list  查看有哪些kernel

jupyter kernelspec remove 虚拟环境名   删除某个kernel

本文标签: WindowsMiniforgeJupyterLab