LoginSignup
0
1

More than 3 years have passed since last update.

anacondaをubuntuにインストール・pythonのversionお手軽変更

Last updated at Posted at 2019-03-22

自分のミスでubuntuを入れ直したので次に設定する際により早く復旧できるように記録.

anacondaのイントール

このリンクから目的のパッケージをインストール.自分の場合は64bit(x86)用のものを取得.

[注意]
なぜかデフォルトがMacOSのものになっているため,何も考えずにポチポチ押すとMacOSのものがインストールされる.

実行

以下を実行して環境を入れる.

bash ~/Downloads/Anaconda3-2018.12-Linux-x86_64.sh

ポチポチ

適当にポチポチしているとインストール終了.以下のコマンドを打つ,もしくはterminalを再起動することでcondaにpathが通って以下のinstallができる.

source ~/.bashrc

パッケージ

好みに合わせてパッケージをインストール.

pip install seaborn
pip install tqdm
pip install simplejson
pip install requests
pip install selenium

ついでにpytorchも入れる.

$ conda install pytorch torchvision cudatoolkit=9.2 -c pytorch

# verification
$ ipython
Python 3.7.2 (default, Dec 29 2018, 06:19:36) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import torch

In [2]: x = torch.rand(5,3)

In [3]: print(x)
tensor([[0.9174, 0.4211, 0.9548],
        [0.0416, 0.2002, 0.7877],
        [0.1526, 0.1630, 0.2964],
        [0.7688, 0.2745, 0.9678],
        [0.5461, 0.8683, 0.6205]])


余談(pythonのversion変更)

conda create -n 環境名 python=x.x
conda activate 環境名

.bashrcにconda activate 環境名を加えておけば,defaultのpythonのversionも変えることができる.

conda env list

上記のコマンドで今までに作成した環境一覧を閲覧可能.

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1