环境:
-
添加
conda env list //显示所有的虚拟环境 conda info --envs //显示所有的虚拟环境 conda create -n xxxx python=3.5 //创建python3.5的xxxx虚拟环境 conda create --name newname --clone oldname //克隆环境 conda create -n xxxx python=3.5 //创建python3.5的xxxx虚拟环境 conda create -n 环境名称 python=3.5 ipykernel //同时安装jupyter内核
-
删除
conda remove --name oldname --all conda remove -n xxxx --all //删除xxxx虚拟环境
-
切换
conda activate ENVNAME //激活环境 conda deactivate //退出环境
-
迁移
conda env export -n my-environment -f my-environment.yml //导出环境 conda env create -f environment.yaml //从外部创建环境 anaconda upload my-environment.yml //上传conda云 conda env create user/my-environment //从云端下载环境
包:
-
安装
conda install --file requirements.txt //从文件批量安装包
-
删除
conda clean -p //删除没有用的包 conda clean -t //tar打包 conda clean -y -all //删除所有的安装包及cache
conda:
conda update conda
conda update anaconda
conda update anaconda-navigator //update最新版本的anaconda-navigator
conda update -n base conda //update最新版本的conda
jupyter notebook:
-
添加环境
-
首先安装ipykernel:
conda install ipykernel //在虚拟环境下创建kernel文件
-
在terminal下执行命令行:
conda install -n 环境名称 ipykernel
-
激活conda环境
-
将环境写入notebook的kernel中 :
python -m ipykernel install --user --name 环境名称 --display-name "在jupyter中显示的环境名称"
这里引号里面的名称自己可以随便起,用于在jupyter里面做标识
-
打开notebook服务器
-
-
删除环境
jupyter kernelspec remove 环境名称
-
改变工作路径
默认jupyter notebook打开的root目录挂载在C盘,可以打开cmd手动切换到D盘:
jupyter notebook --generate-config //路径下生成jupyter_notebook_config.py文件
在jupyter_notebook_config.py中修改
## The directory to use for notebooks and kernels. #c.NotebookApp.notebook_dir = ''
为:
## The directory to use for notebooks and kernels. c.NotebookApp.notebook_dir = 'E:\Jupyter'
找到Anaconda创建的快捷方式 ,右键属性进入并修改起始位置的地址为目标路径;
删除”目标“属性中的“%USERPROFILE%”。
打开jupyter notebook:
cd /d D: //切换目前路径 jupyter notebook //打开