Conda 下的 python 包操作 (Anaconda Prompt)

  • 安装某个包 / install the specific package:
conda install -c conda-forge '+ the extension package name'
  • 批量安装包 / install packages in bulk / batch:
conda install -c conda-forge '+package_1' '+package_2' ...
  • 删除某个特定包
conda uninstall -c conda-forge '+ packageName'
  • 查看 python 版本:
python -V

在 python 运行界面中查看 python 版本的方法:

import sys
print(sys.version)
  • 查看已安装的包列表
conda list
  • 查看某个包是否安装
conda list '+ package'
  • channel
# 查看自己 conda 配置的channel,同时会显示优先级
conda config --get channels

# 添加新的 channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes 
# 新添加的 channel 具有最高优先级
# 设置优先级之后,可以不用 -c 来指定 channel 安装

# 添加最高优先级的 channel
conda config --prepend channels new_channel # prepend = add
# 添加最低优先级的 channel
conda config --append channels new_channel

# 移除 channel conda-forge
conda config --remove channels conda-forge

# channel_priority:strict, flexible or disable
conda config --describe channel_priority

# 不使用 channel_priority
conda config --set channel_priority false

# 设置 channel_priority
conda config --set channel_priority strict # 可能失效
# 默认conda解析软件依赖时优先考虑允许的最高版本,设置通道优先级权限高于软件版本新旧后,conda会能更快的解决依赖关系,
# 避免defaults和conda-forge通道的奇怪组合导致软件依赖解析迟迟不能将结束的问题
# Strict channel priority can dramatically speed up conda operations and also reduce package incompatibility problem

参考:
conda命令大全
痛点:Anaconda3 python第三方库批量安装

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值