zoukankan      html  css  js  c++  java
  • conda、pip换源以及conda、pip命令比较

    conda换源:

    旧换源设置:

    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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    conda config --set show_channel_urls yes

    新换源设置:

    修改用户目录下的 .condarc 文件:

    channels:
      - defaults
    show_channel_urls: true
    channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
    default_channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
      conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

    pip换源:

    pip install pip -U
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

    conda 命令参考:

    https://docs.conda.io/projects/conda/en/latest/commands.html

    Task

    Conda package and environment manager command

    Pip package manager command

    Virtualenv environment manager command

    Install a package

    conda install $PACKAGE_NAME

    pip install $PACKAGE_NAME

    X

    Update a package

    conda update --name $ENVIRONMENT_NAME $PACKAGE_NAME

    pip install --upgrade $PACKAGE_NAME

    X

    Update package manager

    conda update conda

    Linux/macOS: pip install -U pip

    Win: python -m pip install -U pip

    X

    Uninstall a package

    conda remove --name $ENVIRONMENT_NAME $PACKAGE_NAME

    pip uninstall $PACKAGE_NAME

    X

    Create an environment

    conda create --name $ENVIRONMENT_NAME python

    X

    cd $ENV_BASE_DIR; virtualenv $ENVIRONMENT_NAME

    Activate an environment

    conda activate $ENVIRONMENT_NAME*

    X

    source $ENV_BASE_DIR/$ENVIRONMENT_NAME/bin/activate

    Deactivate an environment

    source deactivate

    X

    deactivate

    Search available packages

    conda search $SEARCH_TERM

    pip search $SEARCH_TERM

    X

    Install package from specific source

    conda install --channel $URL $PACKAGE_NAME

    pip install --index-url $URL $PACKAGE_NAME

    X

    List installed packages

    conda list --name $ENVIRONMENT_NAME

    pip list

    X

    Create requirements file

    conda list --export

    pip freeze

    X

    List all environments

    conda info --envs

    X

    Install virtualenv wrapper, then lsvirtualenv

    Install other package manager

    conda install pip

    pip install conda

    X

    Install Python

    conda install python=x.x

    X

    X

    Update Python

    conda update python*

    X

    X

  • 相关阅读:
    深入理解JavaScript系列(45):代码复用模式(避免篇)
    深入理解JavaScript系列(38):设计模式之职责链模式
    深入理解JavaScript系列(43):设计模式之状态模式
    认识js中的function和this
    深入理解JavaScript系列(29):设计模式之装饰者模式
    javascript的内存分配
    详细解读Jquery各Ajax函数
    javascript 杂谈之哪种写法你更喜欢?
    深入理解JavaScript系列(28):设计模式之工厂模式
    深入理解JavaScript系列(30):设计模式之外观模式
  • 原文地址:https://www.cnblogs.com/jacen789/p/11440000.html
Copyright © 2011-2022 走看看