grr

Python 3 環境構築 「Getting Started」

Python 3 環境構築 「Getting Started」

Python 3.6.5 を実行するための基本的な動作環境構築。
インストールから文字の表示「Hello World!」実行まで。

プログラミング言語 Python

Pythonは多様な分野で使われている、パワフルな動的プログラミング言語です。
比較的学習しやすい言語です。

Python 3 学習情報

Python>>> About>>> Getting Started
https://www.python.org/about/gettingstarted/
The Python Tutorial 3.6.5
https://docs.python.org/3.6/tutorial/index.html#the-python-tutorial
Python チュートリアル 3.6.5
https://docs.python.jp/3/tutorial/index.html
Python 3.6.5 documentation
https://docs.python.org/3/index.html
Python 3.6.5 ドキュメント
https://docs.python.jp/3/index.html
Dive Into Python 3
http://www.diveintopython3.net/
Dive Into Python 3 日本語版
http://diveintopython3-ja.rdy.jp/

(書籍)詳細!Python3入門ノート
https://honto.jp/netstore/pd-book_28495507.html
(学習サイト)【世界で5万人が受講】実践 Python データサイエンス | Udemy
https://www.udemy.com/python-jp/learn/v4/
(学習サイト)Python入門 | 10秒で始めるAIプログラミング学習サービスAidemy[アイデミー]
https://aidemy.net/courses/3010

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Pythonのバージョン

Python 2 と Python 3 があり、Python 3 から始まるのが新しいバージョン。
Python 3 への移行が推奨されており、新しく学ぶのであれば 2 より 3 が良いです。

インストール(Windows 10)

Windowsの場合はインストール用実行ファイルをダウンロードし実行する。
数字が新しい、最新のバージョンをインストールする。
Python.org
https://www.python.org/
Python 3.6.5 (Windows x86-64 executable installer) インストール用実行ファイルには、Python 3 の他に、標準のライブラリや統合開発環境(IDE)などのソフトウェアも含まれています。

PATH システム環境変数(Windows)

コマンドラインPythonを実行できるようにPATH(システム環境変数)を設定する。
インストール時に、自動的にPATHが設定されるように指定することもできる。「Add Python to PATH」

(python.exeのフォルダパス) (python.exeのフォルダパス)\Scripts\

インストール(Ubuntu 17)

sudo apt-get install python3
python -m pip install --upgrade pip

起動

コンソール(コマンドライン)で python もしくは python3 とコマンド入力し起動。
Python のコマンドの後に .py ファイルを指定することで、.py ファイルに保存したコードが実行できる。

文字の表示

画面に文字を出力する。例文「Hello World!」

print("Hello World!")

Hello World!