Conda紹介

10030 ワード

概要
condaはnpmやmavenのようなパッケージ管理ツールですが、condaはpython向けです.mincondaまたはanacondaをインストールできます.前者は簡略化されたバージョンで、condaとその依存性のみが含まれています.インストール環境にpython関連パッケージがあっても関係ない場合は、アンインストールする必要はありません.
anacondaはwindows、mac、linuxシステムをサポートし、GUIとcommand lineバージョンの2つのタイプがあり、前者はグラフィックインタフェースで、後者はコマンドラインインタフェースで、リソースの消費量が少ない.
condaにはpython 3があります.xとpython 2.xシリーズの2つのバージョンは、condaを使用して環境を作成するときにpythonのバージョンを指定できるため、実際には関係ありません.
インストールチュートリアル:https://conda.io/docs/user-guide/install/index.html#installing-conda-on-a-system-that-has-other-python-installations-or-packages
コマンド#コマンド#
注意:一般的には、-長い単語の後に続くパラメータは、-単一のアルファベットのパラメータに等しい
  • 判定バージョン
  • conda --version
    ##   
    conda -V
    
    ##        
    conda update conda
  • ヘルプ情報を表示
  • conda --help
    conda -h
  • 環境に対する操作(condaは環境によって異なるpackageのバージョンの問題を分離する)
  • 異なる環境は~/anacoda 2/envs/xxxディレクトリにインストールされます
    1、    
    conda create --name [name] [dependent package list]
    
      :
    conda create --name snowflakes biopython
       python  
    conda create --name bunnies python=3.5 astroid babel
    
    2、            
    conda create --name flowers --clone snowflakes
    
    3、    
        •   Linux and macOS: source activate snowflakes
        •   Windows: activate snowflakes
    
    4、      
    conda info --envs
    
    ali-186590cc30b9:~ liujun$ conda info --envs
    # conda environments:
    #
    snowflakes               /Users/liujun/anaconda2/envs/snowflakes
    root                  *  /Users/liujun/anaconda2
    
    5、    ,    root  
        •   Linux, macOS: source deactivate
        •   Windows: deactivate
    
    6、      
    conda remove --name flowers --all
  • パッケージ管理コマンド
  • 1、         
    conda search --full-name python
    conda search beautifulsoup4
    
    
           :
    https://anaconda.org/
    
    2、           
    conda list
    
    3、       
    conda install numpy=1.13.3
    conda install --name [    ] beautifulsoup4
              
        1.  In a browser, go to http://anaconda.org.

        2.  Look for a package named “bottleneck”:
        1.  In the top-left corner of the screen, in the Search Anaconda Cloud box, type bottleneck.
        2.  Click the Search button.
        3.  There are more than a dozen copies of bottleneck available on Anaconda.org, but you want the most frequently downloaded copy.4.  Click the Downloads column heading to sort the results by number of downloads.

        5.  Click the package name of the version that has the most downloads.
The Anaconda.org detail page appears, showing the command to use to download the package:
    
        conda install -c conda-forge bottleneck
    
        6.  Run the displayed command.

    
      pip    
    
    pip         ,   conda,        ,      python,pip  python     。 pip      conda      ,pip    anaconda minconda    。
    
        
    pip install see
    
    4、   
    conda remove --name [    ] iopro
    
    

    コマンドリストのアドレス:https://conda.io/docs/commands.html
    コンフィギュレーション
    mavenに似たsetting.xmlファイル、condaにもプロファイル(yamlフォーマット)があります.名前は.condarc.パッケージ検索のurlアドレス、proxy構成、環境ディレクトリを指定できます.anacodaのインストールディレクトリは、実は/Users/xxx/anaconda 2なので、プロファイルも~ディレクトリにあります.各環境自体にもプロファイルがあり、アドレスは~/anaconda 2/envs/[環境名]/.condarc
    構成方法は、conda configコマンドの使用、テキストエディタの使用の2つです.
    構成例:https://conda.io/docs/user-guide/configuration/sample-condarc.html
    # This is a sample .condarc file.
    # It adds the r Anaconda.org channel and enables
    # the show_channel_urls option.
    
    # channel locations. These override conda defaults, i.e., conda will
    # search *only* the channels listed here, in the order given.
    # Use "defaults" to automatically include all default channels.
    # Non-url channels will be interpreted as Anaconda.org usernames
    # (this can be changed by modifying the channel_alias key; see below).
    # The default is just 'defaults'.
    channels:
      - r
      - defaults
    
    # Show channel URLs when displaying what is going to be downloaded
    # and in 'conda list'. The default is False.
    show_channel_urls: True
    
    # For more information about this file see:
    # https://conda.io/docs/user-guide/configuration/use-condarc.html
  • conda configコマンド
  • conda config --get        
    conda config --get [key1] [key2]       
    conda config --add [key] [value]      
    conda config --set [key] [value]     
    conda config --remove [key] [value]       
    conda config --remove-key [key]     key
    
    
          
    conda config --help

    一部key値説明
  • パッケージ倉庫
  • の構成
              ,  default    https://conda.anaconda.org/  ,          
      :
    channels:
      - 
      - http://some.custom/channel
      - file:///some/local/directory
      - defaults
    
  • ダウンロードパケットのアドレス
  • を表示する.
    conda listを使用すると、リストに表示される現在の環境でダウンロードされているパッケージのソースchannelが表示されます.この値はデフォルトfalseです.設定する必要がある場合は、次のコマンドを実行します.
    conda config --set show_channel_urls true
  • デフォルトロードパケット
  • を設定する.
    create_default_packagesパラメータは、環境を作成するたびにデフォルトでロードされるパッケージを設定できます.もちろんenvsの作成時に–no-default-packagesを無効にすることもできます.
  • 更新禁止パッケージ
  • デフォルトでは、condaは環境内のすべてのパッケージを更新し、最新バージョンに依存します(conda install numpy=1.9.3など、作成時にバージョンが指定されている場合を除き、update_を指定する必要があります).dependenciesはtrueであり、condaはあなたの構成に依存して指定したパケットのみを更新します.もちろんenvsを作成する場合は、-update-dependenciesまたは-no-update-dependenciesで指定することもできます.
    pingファイル方式で更新を禁止することもできます.リンクを参照してください.https://conda.io/docs/user-guide/tasks/manage-pkgs.html#pinning-packages
    削除
    rm -rf ~/miniconda
    rm -rf ~/.condarc ~/.conda ~/.continuum