文書の過去の版を表示しています。
Python のインストール
Linux 編
殆どの Linux には既に Python が入っています。
$ python3 -V Python 3.8.1
Windows 編
- Welcome to Python.orgのDownload Python | Python.orgより最新バージョンをダウンロードしてくる。(ここでは python-3.8.1-amd64.exe を使用する。)
- ダウンロードした python-3.8.1-amd64.exe を実行して、[Customize installation] をクリックする。
- Advanced Options の [v]Install for all users にチェックを入れて Customize install location を C:\Python38 に変更する。(お好みで…)
- [Install] をクリックする。
- インストールが終わったら [Disable path length limit] をクリックしておく。
- タスクバーの「ここに入力して検索」に sysdm.cpl を入力して Enter キーを押す。
- 「システムのプロパティ」の「詳細設定」タブの[環境変数]ボタンを押して「環境変数」画面を開く。
- システム環境変数の Path に Python のフォルダ(C:\Python38;C:\Python38\Scripts;)を追加する。
Path:
C:\Python38;C:\Python38\Scripts;C:\Program Files...
- コマンドラインにて動作確認を行う。
> python -V Python 3.8.1
> python -VV Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)]
- pip をアップグレードする。
> python -m pip install --upgrade pip
Collecting pip Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 19.2.3 Uninstalling pip-19.2.3: Successfully uninstalled pip-19.2.3 Successfully installed pip-20.0.2
> pip -V pip 20.0.2 from c:\python38\lib\site-packages\pip (python 3.8)
Linux & Mac (pythonbrew) 編
ここでは pythonbrew を使って python をインストールします。
python のインストール
python 2.7.3 をインストールする。
$ pybrew install 2.7.3 Downloading Python-2.7.3.tgz as /Users/tomoyan/.pythonbrew/dists/Python-2.7.3.tgz ######################################################################## 100.0% Extracting Python-2.7.3.tgz into /Users/tomoyan/.pythonbrew/build/Python-2.7.3 This could take a while. You can run the following command on another shell to track the status: tail -f "/Users/tomoyan/.pythonbrew/log/build.log" Patching Python-2.7.3 Installing Python-2.7.3 into /Users/tomoyan/.pythonbrew/pythons/Python-2.7.3 Downloading distribute_setup.py as /Users/tomoyan/.pythonbrew/dists/distribute_setup.py ######################################################################## 100.0% Installing distribute into /Users/tomoyan/.pythonbrew/pythons/Python-2.7.3 Installing pip into /Users/tomoyan/.pythonbrew/pythons/Python-2.7.3 Installed Python-2.7.3 successfully. Run the following command to switch to Python-2.7.3. pythonbrew switch 2.7.3
python を切り替える
$ pybrew switch 2.7.3 Switched to Python-2.7.3 $ python -V Python 2.7.3
python 3.2.3 をインストールする。
$ pybrew install 3.2.3 Downloading Python-3.2.3.tgz as /Users/tomoyan/.pythonbrew/dists/Python-3.2.3.tgz ######################################################################## 100.0% Extracting Python-3.2.3.tgz into /Users/tomoyan/.pythonbrew/build/Python-3.2.3 This could take a while. You can run the following command on another shell to track the status: tail -f "/Users/tomoyan/.pythonbrew/log/build.log" Installing Python-3.2.3 into /Users/tomoyan/.pythonbrew/pythons/Python-3.2.3 Downloading distribute_setup.py as /Users/tomoyan/.pythonbrew/dists/distribute_setup.py ######################################################################## 100.0% Installing distribute into /Users/tomoyan/.pythonbrew/pythons/Python-3.2.3 Installing pip into /Users/tomoyan/.pythonbrew/pythons/Python-3.2.3 Installed Python-3.2.3 successfully. Run the following command to switch to Python-3.2.3. pythonbrew switch 3.2.3
python を切り替える
$ pybrew switch 3.2.3 Switched to Python-3.2.3 $ python -V Python 3.2.3