conda常见命令

常用命令

  • 创建虚拟环境

    1
    2
    3
    conda  create  --name  env_name
    conda create --name env_name python=3.6 # 创建指定python版本
    conda create --name env_name python=3.6 pandas numpy scipy # 创建指定python版本下包含某些包
  • 激活虚拟环境

    1
    activate  env_name
  • 退出当前环境

    1
    deactivate
  • 复制虚拟环境

    1
    conda  create  --name  new_env_name  --clone  old_env_name
  • 删除虚拟环境

    1
    conda  remove  --name  env_name  --all
  • 查看所有环境

    1
    conda  info  --envs   或者  conda  env  list
  • 查看当前环境所有的包

    1
    2
    conda  list  需进入该虚拟环境
    conda list -n env_name
  • 安装/卸载包

    1
    2
    3
    4
    conda  install  requests
    conda install xx=版本号 # 指定版本号
    conda install xxx -i 源名称或链接 # 指定下载源
    conda uninstall xxx
  • 更新包

    1
    2
    pip install --upgrade 库的名字
    pip install -U numpy # 更新numpy
  • 升级anaconda

    1
    2
    conda  update  conda
    conda update anaconda
  • 卸载

    1
    rm  -rf  anaconda
  • 换源

    1
    2
    3
    4
    5
    6
    7
    8
    conda config --show-sources #查看当前使用源
    conda config --remove channels 源名称或链接 #删除指定源
    conda config --add channels 源名称或链接 #添加指定源

    阿里云 http://mirrors.aliyun.com/pypi/simple/
    中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
    中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
    清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  • 缓存清理

    1
    2
    3
    conda clean -p       # 删除没有用的包 --packages
    conda clean -t # 删除tar打包 --tarballs
    conda clean -y --all # 删除所有的安装包及cache(索引缓存、锁定文件、未使用过的包和tar包)
Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2023-2025 John Doe
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信