conda使用记录

conda使用记录

创建虚拟环境

# 创建名为env_name的虚拟环境
conda create --name env_name# 创建名为env_name的虚拟环境,指定python版本
conda create --name env_name python=3.8# 创建指定python版本下包含某些包的env_name虚拟环境
conda  create  --name  env_name python=3.6 pandas numpy scipy 

查看所有虚拟环境

conda info --envs
# 或者
conda env list

退出当前虚拟环境

deactivate

激活/进入虚拟环境

activate  env_name

删除某一虚拟环境

conda  remove  --name  env_name  --all

查看当前虚拟环境下的所有的安装包

conda  list  #需进入该虚拟环境conda  list  -n  env_name

安装或卸载包(进入虚拟环境之后)

conda  install  requests
conda  install  xx=版本号  # 指定版本号
conda  install  xxx -i 源名称或链接 # 指定下载源
conda  uninstall  xxx

分享虚拟环境

conda env export > environment.yml  # 导出当前虚拟环境
conda env create -f environment.yml  # 创建保存的虚拟环境

源服务器管理

#查看当前使用源
conda config --show-sources #删除指定源
conda config --remove channels#添加指定源
conda config --add channels #例子
conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

pip源

阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/豆瓣(douban) http://pypi.douban.com/simple/清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/