python-is-python3が出た時の対処方法。pythonコマンドでpython3を実行する方法

Ubuntuでpython3がインストールされている環境でpythonコマンドを実行すると以下のメッセージが発生します。。

$ python

Command 'python' not found, did you mean:

  command 'python3' from deb python3
  command 'python' from deb python-is-python3

これはpythonコマンドがないため発生しています。

また既にpython3が導入されている環境でも同様のエラーメッセージが発生します。

本記事はメッセージの解決方法pythonコマンドでpython3するための方法を紹介します。

目次

解決方法

解決方法はシンプルでpython-is-python3を導入すれば解決します。

apt install python-is-python3

以下が実行時のログです。

# apt install python-is-python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  python-is-python3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,364 B of archives.
After this operation, 10.2 kB of additional disk space will be used.
Get:1 http://jp.archive.ubuntu.com/ubuntu focal/main amd64 python-is-python3 all 3.8.2-4 [2,364 B]
Fetched 2,364 B in 0s (4,779 B/s)
Selecting previously unselected package python-is-python3.
(Reading database ... 108105 files and directories currently installed.)
Preparing to unpack .../python-is-python3_3.8.2-4_all.deb ...
Unpacking python-is-python3 (3.8.2-4) ...
Setting up python-is-python3 (3.8.2-4) ...

動作確認してみましょう。

# python
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

以上のようにpythonコマンドでpython3が実行されるようになりました。

よかったらシェアしてね!
  • URLをコピーしました!
目次