安装
参考我的这篇文章即可,Ubuntu20.04安装Anaconda
常见用法
Ⅰ. 创建虚拟环境
conda create --name name python=3.8
name
就是你要创建的虚拟环境的名字,python
指定版本后,就会自动寻找这个版本的最新版本。
Ⅱ. 激活环境
activate name # windows
source activate name # linux
如果 source activate name
失效,说明找不到 activate
这个命令了。
如下信息:
source: no such file or directory: activate
事实上,最新版的 conda
也会给你个警告,说这个方法已经被禁用了。
使用 conda activate name
即可。
Ⅲ. 退出虚拟环境
conda deactivate name
Ⅳ. 删除虚拟环境
conda remove --name name --all
Ⅴ. 查看所有的虚拟环境
conda info -e
conda包管理
Ⅰ. 安装包
conda install 包名
Ⅱ. 查看已经安装的包
conda list
Ⅲ. 更新
conda update conda
conda update anaconda
Ⅳ. 删除包
conda uninstall 包名
换源
anaconda
服务器在国外,下载包的速度会超级慢,改成清华源,速度会有质的改善。
执行如下命令:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes