Conda - Silently installing a package

前端 未结 3 1558
广开言路
广开言路 2020-12-13 12:44

I am trying to automate the process of setting up a development environment with pandas package using conda.

I installed conda, created and activated a dev environm

相关标签:
3条回答
  • 2020-12-13 13:01

    I suggest not to pass the confirmation process.

    because it always has important info regarding this installation(which package will be updated and which dependency package will be installed and which package will be downgraded)

    I once corrupt my environment due to not notice the update some of the package and took a long time to figure out some package need to stay in a older version to make some other package run properly.And that confirmation details will always makes you informed and tell you where to debug once you corrupt your package environment after installation

    Anyway, here is the solution. Just use -y flag :

    conda install -y PACKAGE_NAME
    
    0 讨论(0)
  • 2020-12-13 13:10

    Used $conda install -y pandas and it installed without any prompts (see documentation).

    0 讨论(0)
  • 2020-12-13 13:14

    One-time Use

    -y, --yes option.

    # e.g. No.1
    conda create -n myenv python=3.6 -y
    
    # e.g. No.2
    # install into a specific environment
    conda install -n myenv requests -y
    # install into the "base" env
    conda install flake8 --yes
    

    Script Use

    Warning. This method confirms any type of prompt.

    export CONDA_ALWAYS_YES="true"
    
    # confirm all following "conda" commands
    conda create -n myenv
    conda install -n myenv requests
    # ...
    
    # Disable yes to all
    unset CONDA_ALWAYS_YES 
    

    You may need to check How to activate conda env through shell script.


    Environment Specific Use

    Warning. This method confirms any type of prompt.

    Enable "yes" to any prompt within current active env.

    # enable yes to all in current env
    conda config --env --set always_yes true
    
    # disable it in current env
    conda config --env --remove always_yes
    
    0 讨论(0)
提交回复
热议问题