LoginSignup
2
2

More than 3 years have passed since last update.

macOS Big SurでPythonをはじめてみる

Last updated at Posted at 2020-12-27
  • はじめる人は、Unix系OSの基本的な知識はある
  • Pythonははじめてで、知識ゼロ
  • 環境はAppleのiMac(mid 2020、x86_64の最後のiMac??)、macOS Big Surにアップデート済み

2021/1/9更新:Python3というコマンドがインストールされていたのに気づいて、記述を変更追加。


現状確認

iMacにはおそらくPythonはプリインストールされていると思うので、ターミナルを起動して現状確認してみる。

% which python
/usr/bin/python

Pythonのコマンドがあった。
どう使うのかな?

% man python

PYTHON(1)                                                                                                                                                    PYTHON(1)

NAME
       python - an interpreted, interactive, object-oriented programming language

SYNOPSIS
       python [ -B ] [ -d ] [ -E ] [ -h ] [ -i ] [ -m module-name ]
              [ -O ] [ -OO ] [ -R ] [ -Q argument ] [ -s ] [ -S ] [ -t ] [ -u ]
              [ -v ] [ -V ] [ -W argument ] [ -x ] [ -3 ] [ -?  ]
              [ -c command | script | - ] [ arguments ]

Vオプションで、バージョンが確認できるみたいだ。

% python -V
Python 2.7.16

インストールされているPythonは、2.7.16みたいだ。
binディレクトリも見てみる

% ls -l /usr/bin/python*
-rwxr-xr-x  1 root  wheel  137536  1  1  2020 /usr/bin/python3

python3というコマンドがあった。

% man python3   
No manual entry for python3

manはない。

% python3 -V
Python 3.8.2

バージョン3.8.2もあるみたい。
今の最新バージョンはいくつなのかな?
manでpython(1)の下の方を見ると、Webサイトがいくつか書いてある。

INTERNET RESOURCES
       Main website:  https://www.python.org/

Pythonのメイン・ウェブサイトを見てみると、2020/12/21にバージョン3.8.7がでているみたい。
Pythonのメイン・ウェブサイトを眺めていると、Pythonのバージョン2系とPythonバージョン3系には、大きな?違いがあるようだ。
2系から3系へのポーティング・ガイドもあるので、おそらくは言語仕様の非互換を伴うバージョンアップらしい。

現状確認ができたので、今日はここまで。
次は以下を満たす参考書を探そうかな。

  • Pythonのバージョン2系とバージョン3系の解説があること
  • プログラム経験はあるけど、Pythonは初心者という人向けであること
2
2
1

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