3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RHEL7にAnacondaを入れる

Posted at

やりたいこと

Anacondaをインストールしたい

環境

RHEL7
標準でpython2.7.xが入ってた。

手順

手順1:pythonのバージョンを最新にする

yumパッケージを探す。最新版はpython3.6だったので以下のようにする。
$ yum search python36

rh-python36が最新pythonのパッケージっぽいのでインストールする。
$ yum -y install rh-python36

pythonのバージョンを確認する
$ python -V

パスを確認する
$ which python

パスを通す
vi etc/profile.d/python36.sh

手順2:Anacondaをインストールする

Anacondaをダウンロード
※参考ダウンロードサイト
$ wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh

インストールする
$bash Anaconda3-5.1.0-Linux-x86_64.sh

ここで、規約の同意やインストールの場所が聞かれるのでこだわりがなければyesにしておく。

PATHを通す
$ vi ~/.bashrc
下記を追記する
export PATH=/path/to/anaconda3/bin:$PATH

手順3:確認する

ちゃんとインストールできているか確認する。
Anacondaがインストールできていれば下記のようになる。

$ python
Python 3.6.0 |Anaconda 4.3.0 (64-bit)| (default, Dec 23 2016, 12:22:00) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

Anacondaがインストールできていれば下記のコマンドでnumpyもインポートできるはず。

>>> import numpy
>>> numpy.__file__
'/path/to/anaconda3/lib/python3.6/site-packages/numpy/__init__.py'

注意点

  • python2.7.Xとか、バージョンが古いものが標準で入っていた場合は先にバージョンアップする。
  • 古いバージョンのpythonが邪魔だからと言ってyum remove pythonはしてはいけない。 ※参考CentOS で yum remove pythonをしたら詰みました。

参考サイト

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?