python 环境去掉_JupyterLab的安装及使用Python虚拟环境
JupyterLab官网:
Project Jupyterjupyter.org1、安装JupyterLab
使用pip命令安装:
pip install jupyterlab
2、打开JupyterLab
在控制台(或terminal)中输入命令:
jupyter lab
即可在浏览器中打开jupyter lab。
3、更改默认工作路径
在控制台(或terminal)中输入命令:
jupyter lab --generate-config
会在默认路径下生成一个jupyter_notebook_config.py文件。打开它,找到c.NotebookApp.notebook_dir这一行,输入你要指定的工作目录,并把前面的“#”去掉,保存即可,下次打开JupyterLab时就会是指定的工作目录了。
4、使用Python虚拟环境
如果你使用virtualenv创建了一个Python虚拟环境,那么首先进入到这个虚拟环境中,然后运行命令:
python -m ipykernel install --user --name=xxx
其中"xxx"表示虚拟环境的名字,这样就可以在JupyterLab中使用这个虚拟环境了。
注:封面图来自JupyterLab官网。