python コマンド単体で呼べるようにする sudo alternatives –config python

https://サーバー構築と設定.com/?p=4038

python コマンド単体で呼べるようにする

python3 や python3.6 のままでは使いづらいため、
python コマンド単体でも実行できるように alternatives コマンドで設定を行います。

インストール済みの Python 一覧が出てきます。
Python 3 の左側にある番号(今回は2)を入力して、Enter で設定完了です。

$ sudo alternatives –config python
There are 2 programs which provide ‘python’.

Selection Command
———————————————–
*+ 1 /usr/libexec/no-python
2 /usr/bin/python3

Enter to keep the current selection[+], or type selection number: 2

python コマンド単体で実行できるようになりました。

$ python –version
Python 3.6.8

コメント