Ccmmutty logo
Commutty IT
7 min read

Anaconda ライブラリインストール チートシート

https://cdn.magicode.io/media/notebox/blob_ip9m67E

概要

AnacondaはPythonの仮想環境を簡単に作成してくれるものです。
仮想環境を作成することで、Mac本体にライブラリを直接インストールしなくてすみます。
これによりさまざまバージョンを環境ごとに作成して、環境を切り替えることで好きな環境を使えるようになります。
そんな仮想環境を作成できる「Anaconda」に色々とインストールするコマンドを紹介していきたいと思います。
ちなみに「Anaconda」で仮想環境を作成しているときは、「pip」でインストールするのではなく、「conda」でインストールしましょう。
理由としては、依存関係がメチャクチャになって色々とめんどくさいことになるからです。
もちろん「Anaconda」に用意されていないものもあるのですが、基本的に「conda」でインストールしましょう。
「Anaconda」自体のインストール方法や「Anaconda」については下の記事を参考にしてください。
それでは早速本題に入っていきましょう!
アルファベット順で確認したい方は下記に記事を参考にしてください。

コマンドはある程度決まっていないの?

「pip」でインストールする際は「pip install ~」というコマンドでインストールできるのですが、「Anaconda」の場合はさまざまなインストールコマンドがあります。
僕自身は何かインストールしたいとき、「conda install ~」とググって公式のインストールコマンドを使用しています。
ちなみにこちらから検索できます。
しかし、毎回ググるのがめんどくさいので、今回この記事にまとめていきたいと思います。
「command + f」で記事内検索ができるので、インストールしたいライブラリを検索にかけて、必要な所に飛んでください!
また、全てをここに載せることはできないので、自分が使用したことがあるものを載せてあります。
今後自分が使用したものを追記して、アップデートしていきたいと思います。

ライブラリのアップデート

ライブラリをアップデートしたい時に使うコマンドを先に紹介しておきます。

一括アップデート

conda update --all

1つのライブラリをアップデート

conda update <library>

ライブラリを検索にかける

「Anaconda」にインストールしたいライブラリが存在するか確認することができます。
conda search <library>

ライブラリ一覧

ライブラリ名コマンドURL
Numpyconda install -c anaconda numpyhttps://anaconda.org/anaconda/numpy
Psycopg2conda install -c anaconda psycopg2https://anaconda.org/anaconda/psycopg2
Pyyamlconda install -c anaconda pyyamlhttps://anaconda.org/anaconda/pyyaml
h5pyconda install -c anaconda h5pyhttps://anaconda.org/anaconda/h5py
Pytorchconda install -c pytorch pytorchhttps://anaconda.org/pytorch/pytorch
Torchvisionconda install -c pytorch torchvisionhttps://anaconda.org/pytorch/torchvision
Efficientnet-pytorchconda install -c conda-forge efficientnet-pytorchhttps://anaconda.org/conda-forge/efficientnet-pytorch
Scikit-learnconda install -c conda-forge scikit-learnhttps://anaconda.org/conda-forge/scikit-learn
Scikit imageconda install -c anaconda scikit-imagehttps://anaconda.org/anaconda/scikit-image
Matplotlibconda install -c conda-forge matplotlibhttps://anaconda.org/conda-forge/matplotlib
Tqdmconda install -c conda-forge tqdmhttps://anaconda.org/conda-forge/tqdm
Pillowconda install -c conda-forge pillowhttps://anaconda.org/conda-forge/pillow
Djangoconda install -c conda-forge djangohttps://anaconda.org/conda-forge/django
Graphene-djangoconda install -c conda-forge graphene-djangohttps://anaconda.org/conda-forge/graphene-django
Timmconda install -c conda-forge timmhttps://anaconda.org/fastai/timm
Timmlconda install -c conda-forge timmlhttps://anaconda.org/conda-forge/timml
Dataclassesconda install -c conda-forge dataclasseshttps://anaconda.org/search?q=dataclasses
Poetryconda install -c conda-forge poetryhttps://anaconda.org/conda-forge/poetry
Pandasconda install -c conda-forge pandashttps://anaconda.org/conda-forge/pandas
Tensorflowconda install -c conda-forge tensorflowhttps://anaconda.org/conda-forge/tensorflow
jupyterconda install -c anaconda jupyterhttps://anaconda.org/anaconda/jupyter
Ipythonconda install -c conda-forge ipythonhttps://anaconda.org/conda-forge/ipython
Seabornconda install -c conda-forge seabornhttps://anaconda.org/conda-forge/seaborn
Keras-tunerconda install -c conda-forge keras-tunerhttps://anaconda.org/conda-forge/keras-tuner
Tensorflow-probabilityconda install -c conda-forge tensorflow-probabilityhttps://anaconda.org/conda-forge/tensorflow-probability
Imageioconda install -c conda-forge imageiohttps://anaconda.org/conda-forge/imageio/
Kerasconda install -c conda-forge kerashttps://anaconda.org/conda-forge/keras
Sacredconda install -c alex-marty sacredhttps://anaconda.org/alex-marty/sacred
Beautifulsoup4conda install -c anaconda beautifulsoup4https://anaconda.org/anaconda/beautifulsoup4
Seleniumconda install -c conda-forge seleniumhttps://anaconda.org/conda-forge/selenium
scrapyconda install -c conda-forge scrapyhttps://anaconda.org/conda-forge/scrapy
Protegoconda install -c conda-forge protegohttps://anaconda.org/conda-forge/protego
Openpyxlconda install -c anaconda openpyxlhttps://anaconda.org/anaconda/openpyxl
Xlrdconda install -c anaconda xlrdhttps://anaconda.org/anaconda/xlrd
Mysqlclientconda install -c bioconda mysqlclienthttps://anaconda.org/bioconda/mysqlclient
Tinydbconda install -c conda-forge tinydbhttps://anaconda.org/conda-forge/tinydb

最後に

今回は「Anaconda」でライブラリをインストールするときのコマンドを見てきました。
まだまだほんの一部しか紹介できていないので、今後自分が使用したものを追記してアップデートしていきたいと思います。
それでは!

Discussion

コメントにはログインが必要です。