Anaconda ライブラリインストール チートシート
概要
AnacondaはPythonの仮想環境を簡単に作成してくれるものです。
仮想環境を作成することで、Mac本体にライブラリを直接インストールしなくてすみます。
これによりさまざまバージョンを環境ごとに作成して、環境を切り替えることで好きな環境を使えるようになります。
そんな仮想環境を作成できる「Anaconda」に色々とインストールするコマンドを紹介していきたいと思います。
ちなみに「Anaconda」で仮想環境を作成しているときは、「pip」でインストールするのではなく、「conda」でインストールしましょう。
理由としては、依存関係がメチャクチャになって色々とめんどくさいことになるからです。
もちろん「Anaconda」に用意されていないものもあるのですが、基本的に「conda」でインストールしましょう。
「Anaconda」自体のインストール方法や「Anaconda」については下の記事を参考にしてください。
それでは早速本題に入っていきましょう!
アルファベット順で確認したい方は下記に記事を参考にしてください。
Anacondaでインストールするときのコマンドチートシート
コマンドはある程度決まっていないの?
「pip」でインストールする際は「pip install ~」というコマンドでインストールできるのですが、「Anaconda」の場合はさまざまなインストールコマンドがあります。
僕自身は何かインストールしたいとき、「conda install ~」とググって公式のインストールコマンドを使用しています。
ちなみにこちらから検索できます。
しかし、毎回ググるのがめんどくさいので、今回この記事にまとめていきたいと思います。
「command + f」で記事内検索ができるので、インストールしたいライブラリを検索にかけて、必要な所に飛んでください!
また、全てをここに載せることはできないので、自分が使用したことがあるものを載せてあります。
今後自分が使用したものを追記して、アップデートしていきたいと思います。
ライブラリのアップデート
ライブラリをアップデートしたい時に使うコマンドを先に紹介しておきます。
一括アップデート
conda update --all
1つのライブラリをアップデート
conda update <library>
ライブラリを検索にかける
「Anaconda」にインストールしたいライブラリが存在するか確認することができます。
conda search <library>
ライブラリ一覧
| ライブラリ名 | コマンド | URL |
|---|---|---|
| Numpy | conda install -c anaconda numpy | https://anaconda.org/anaconda/numpy |
| Psycopg2 | conda install -c anaconda psycopg2 | https://anaconda.org/anaconda/psycopg2 |
| Pyyaml | conda install -c anaconda pyyaml | https://anaconda.org/anaconda/pyyaml |
| h5py | conda install -c anaconda h5py | https://anaconda.org/anaconda/h5py |
| Pytorch | conda install -c pytorch pytorch | https://anaconda.org/pytorch/pytorch |
| Torchvision | conda install -c pytorch torchvision | https://anaconda.org/pytorch/torchvision |
| Efficientnet-pytorch | conda install -c conda-forge efficientnet-pytorch | https://anaconda.org/conda-forge/efficientnet-pytorch |
| Scikit-learn | conda install -c conda-forge scikit-learn | https://anaconda.org/conda-forge/scikit-learn |
| Scikit image | conda install -c anaconda scikit-image | https://anaconda.org/anaconda/scikit-image |
| Matplotlib | conda install -c conda-forge matplotlib | https://anaconda.org/conda-forge/matplotlib |
| Tqdm | conda install -c conda-forge tqdm | https://anaconda.org/conda-forge/tqdm |
| Pillow | conda install -c conda-forge pillow | https://anaconda.org/conda-forge/pillow |
| Django | conda install -c conda-forge django | https://anaconda.org/conda-forge/django |
| Graphene-django | conda install -c conda-forge graphene-django | https://anaconda.org/conda-forge/graphene-django |
| Timm | conda install -c conda-forge timm | https://anaconda.org/fastai/timm |
| Timml | conda install -c conda-forge timml | https://anaconda.org/conda-forge/timml |
| Dataclasses | conda install -c conda-forge dataclasses | https://anaconda.org/search?q=dataclasses |
| Poetry | conda install -c conda-forge poetry | https://anaconda.org/conda-forge/poetry |
| Pandas | conda install -c conda-forge pandas | https://anaconda.org/conda-forge/pandas |
| Tensorflow | conda install -c conda-forge tensorflow | https://anaconda.org/conda-forge/tensorflow |
| jupyter | conda install -c anaconda jupyter | https://anaconda.org/anaconda/jupyter |
| Ipython | conda install -c conda-forge ipython | https://anaconda.org/conda-forge/ipython |
| Seaborn | conda install -c conda-forge seaborn | https://anaconda.org/conda-forge/seaborn |
| Keras-tuner | conda install -c conda-forge keras-tuner | https://anaconda.org/conda-forge/keras-tuner |
| Tensorflow-probability | conda install -c conda-forge tensorflow-probability | https://anaconda.org/conda-forge/tensorflow-probability |
| Imageio | conda install -c conda-forge imageio | https://anaconda.org/conda-forge/imageio/ |
| Keras | conda install -c conda-forge keras | https://anaconda.org/conda-forge/keras |
| Sacred | conda install -c alex-marty sacred | https://anaconda.org/alex-marty/sacred |
| Beautifulsoup4 | conda install -c anaconda beautifulsoup4 | https://anaconda.org/anaconda/beautifulsoup4 |
| Selenium | conda install -c conda-forge selenium | https://anaconda.org/conda-forge/selenium |
| scrapy | conda install -c conda-forge scrapy | https://anaconda.org/conda-forge/scrapy |
| Protego | conda install -c conda-forge protego | https://anaconda.org/conda-forge/protego |
| Openpyxl | conda install -c anaconda openpyxl | https://anaconda.org/anaconda/openpyxl |
| Xlrd | conda install -c anaconda xlrd | https://anaconda.org/anaconda/xlrd |
| Mysqlclient | conda install -c bioconda mysqlclient | https://anaconda.org/bioconda/mysqlclient |
| Tinydb | conda install -c conda-forge tinydb | https://anaconda.org/conda-forge/tinydb |
最後に
今回は「Anaconda」でライブラリをインストールするときのコマンドを見てきました。
まだまだほんの一部しか紹介できていないので、今後自分が使用したものを追記してアップデートしていきたいと思います。
それでは!
Discussion