Python プログラムを動かすために, Windows では「python」, Ubuntu では「python3」などのコマンドを使う.
あるいは, 開発環境や Python コンソール(Jupyter Qt Console,Spyder,PyCharm,PyScripter など)の利用も便利である.
あるいは,オンラインで動くGoogle Colaboratory のノートブックの利用も,場合によっては便利である.
Google Colaboratory のノートブックを使うか, 自分のパソコンで Python を動かすなどがありえる.
Google Colaboratory のノートブックを新規作成を行う.
https://colab.research.google.com
Google Colab はオンラインの Python 開発環境. 使用するには Google アカウントが必要
システム Python を使うことができる(システム Python を使う場合,Python のインストールは行わない)
システム Python を用いるときは,pip, setuptools の更新は次のコマンドで行う.
sudo apt -y update sudo apt -y install python3-pip python3-setuptools
Ubuntu で,システム Python 以外の Python をインストールしたい場合は pyenv が便利である: 別ページで説明している.
Python の URL: http://www.python.org/
【Python, pip の使い方】
Python, pip は,次のコマンドで起動できる.
【Python 開発環境のインストール】
JupyterLab, spyder, nteract (Python 開発環境) のインストールは, Windows でコマンドプロンプトを管理者として実行し, 次のコマンドを実行.
python -m pip install -U pip setuptools jupyterlab jupyter jupyter-console jupytext nteract_on_jupyter spyder
詳しくは,: 別ページで説明している.
JupyterLab, spyder, nteract (Python 開発環境) のインストール: : 別ページで説明している.
コマンドプロンプトを管理者として実行し,次のコマンドを実行.
python -m pip install -U scikit-learn scikit-learn-intelex
sudo apt -y update sudo apt -y install python3-sklearn
LFW (the Labeled Faces in the Wild people dataset)
◆ Python プログラム
import pandas as pd import sklearn.datasets a = sklearn.datasets.fetch_lfw_people(resize=1.0, color=True)
画像データの縦横サイズの確認 (The width and height of face images)
a.data.shape
表示してみる (Display the first face image of the LFW daces dataset)
import pylab as pl pl.imshow(255.0 - a.data[0])