目的
Anaconda31で実行できるPythonのバージョンを検証してみます2
AnacondaとPyPIについて
バージョン違いのPython実行用環境を複数用意しようとした場合、Anacondaの方が簡単に環境構築できます。Anacondaをインストールするだけで、condaコマンドを使って異なるバージョンのPython実行環境を構築できます。
一方、Anacondaと比較されることがあるPyPIで同じことを実施しようとした場合、手動でバージョン管理を行う必要があります。バージョン毎に公式サイトからPythonをダウンロードしてインストールしなければなりません。
Anacondaインストール方法
インストール環境
- Red Hat Enterprise Linux 9.4
- Anaconda3-2024.02-1-Linux-x86_64.sh
インストール方法
- Anaconda公式サイトよりAnacondaをダウンロードします
URL:https://www.anaconda.com/download/ - Anacondaをインストールします
①コマンド実行
$ /bin/bash ./Anaconda3-2024.02-1-Linux-x86_64.sh
②Enterキー押下
Welcome to Anaconda3 2024.02-1
In order to continue the installation process, please review the license agreement.
Please, press ENTER to continue
\>>> (<= Enterキーを押下します)
③「yes」入力
Do you accept the license terms? [yes|no]
\>>> yes (<=「yes」を入力します)
④ディレクトリ入力
Anaconda3 will now be installed into this location:
/home/xxxx/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/xxxx/anaconda3] >>> /xxx/anaconda3/ (<= Anacondaインストールディレクトリ入力します)
⑤「yes」入力
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> yes (<=「yes」を入力します)
⑥インストール終了
No action taken.
Thank you for installing Anaconda3! (<=「Thank you」メッセージ表示されたことを確認します)
- Linux ログイン時、Anacondaが自動起動しないよう設定します
コマンド実行
$ conda config --set auto_activate_base false
Anacondaで実行できるPython(バージョン)の検証
結論
Anaconda(2024年02月版)では、Python2.7、Python3.5〜3.11が使えるようです。3
検証方法
- Python 3.11
$ conda create --name testPy3.11 python=3.11
$ conda activate testPy3.11
(testPy3.11) $ python -V
Python 3.11.9 (<= Pythonバージョン番号を確認します)
(testPy3.11) $ conda deactivate
- Python 3.10
$ conda create --name testPy3.10 python=3.10
$ conda activate testPy3.10
(testPy3.10) $ python -V
Python 3.10.14 (<= Pythonバージョン番号を確認します)
(testPy3.10) $ conda deactivate
- Python 3.9
$ conda create --name testPy3.9 python=3.9
$ conda activate testPy3.9
(testPy3.9) $ python -V
Python 3.9.19 (<= Pythonバージョン番号を確認します)
(testPy3.9) $ conda deactivate
- Python 3.8
$ conda create --name testPy3.8 python=3.8
$ conda activate testPy3.8
(testPy3.8) $ python -V
Python 3.8.19 (<= Pythonバージョン番号を確認します)
(testPy3.8) $ conda deactivate
- Python 3.7
$ conda create --name testPy3.7 python=3.7
$ conda activate testPy3.7
(testPy3.7) $ python -V
Python 3.7.16 (<= Pythonバージョン番号を確認します)
(testPy3.7) $ conda deactivate
- Python 3.6
$ conda create --name testPy3.6 python=3.6
$ conda activate testPy3.6
(testPy3.6) $ python -V
Python 3.6.13 :: Anaconda, Inc. (<= Pythonバージョン番号を確認します)
(testPy3.6) $ conda deactivate
- Python 3.5
$ conda create --name testPy3.5 python=3.5
$ conda activate testPy3.5
(testPy3.5) $ python -V
Python 3.5.6 :: Anaconda, Inc. (<= Pythonバージョン番号を確認します)
(testPy3.5) $ conda deactivate
- Python 2.7
$ conda create --name testPy2.7 python=2.7
$ conda activate testPy2.7
(testPy2.7) $ python -V
Python 2.7.18 :: Anaconda, Inc. (<= Pythonバージョン番号を確認します)
(testPy2.7) $ conda deactivate
- Python 3.4
$ conda create --name testPy3.4 python=3.4
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:(<= エラーメッセージが表示されました)
- python=3.4*
- Python 3.3
$ conda create --name testPy3.3 python=3.3
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:(<= エラーメッセージが表示されました)
- python=3.3*
- Python 2.6
$ conda create --name testPy2.6 python=2.6
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels: (<= エラーメッセージが表示されました)
- python=2.6*
- Python 2.5
$ conda create --name testPy2.5 python=2.5
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels: (<= エラーメッセージが表示されました)
- python=2.5*
参考文献
Anaconda社サイト
プログラミング言語 Python 総合情報サイト - python.jp