1
0

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 1 year has passed since last update.

`python3`系を使いたいのに、`python`と実行すると`python2`系が使われてしまう時の対策

Last updated at Posted at 2021-12-18

例えば、以下のように実行するとpython2系が使われてしまう

$ python --version
Python 2.7.17

/usr/bin/python/usr/bin/python3のシンボリックリンクにする方法もあるが、それが難しい事もある。
この場合は、以下のようにエイリアスを設定すれば簡単にpython3系を使えるようになる。

alias python="python3"

以下のように確認できる

$ python --version
Python 3.6.9

~/.bashrcに記載しておくとターミナル起動時に設定されるので便利

echo "alias python=¥"python3¥"" >> ~/.bashrc
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?