差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| python:python_install [2020/02/02 10:01] – [Python 2.7/3.8 の共存] ともやん | python:python_install [2020/09/11 16:59] (現在) – ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | < | ||
| - | < | ||
| - | #result pre { | ||
| - | height: 200px; | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ====== Python のインストール ====== | ====== Python のインストール ====== | ||
| 行 18: | 行 9: | ||
| ===== Windows 編 ===== | ===== Windows 編 ===== | ||
| + | |||
| + | ==== Scoop によるインストール ==== | ||
| + | [[windows: | ||
| + | ダウンロード元として **versions** バケットを追加する。\\ | ||
| + | < | ||
| + | $ scoop bucket add versions | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Checking repo... ok | ||
| + | The versions bucket was added successfully. | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **python**、**python27** をインストールする。\\ | ||
| + | <code powershell> | ||
| + | $ scoop install python python27 | ||
| + | </ | ||
| + | <WRAP prewrap 100% # | ||
| + | <code powershell> | ||
| + | Installing ' | ||
| + | lessmsi-v1.6.91.zip (495.0 KB) [==============================================================================] 100% | ||
| + | Checking hash of lessmsi-v1.6.91.zip ... ok. | ||
| + | Extracting lessmsi-v1.6.91.zip ... done. | ||
| + | Linking ~\scoop\apps\lessmsi\current => ~\scoop\apps\lessmsi\1.6.91 | ||
| + | Creating shim for ' | ||
| + | Creating shortcut for Less MSIérables (lessmsi-gui.exe) | ||
| + | ' | ||
| + | Installing ' | ||
| + | dark-3.11.2.zip (3.5 MB) [====================================================================================] 100% | ||
| + | Checking hash of dark-3.11.2.zip ... ok. | ||
| + | Extracting dark-3.11.2.zip ... done. | ||
| + | Linking ~\scoop\apps\dark\current => ~\scoop\apps\dark\3.11.2 | ||
| + | Creating shim for ' | ||
| + | ' | ||
| + | Installing ' | ||
| + | install-pep-514.reg (555 B) [=================================================================================] 100% | ||
| + | Checking hash of install-pep-514.reg ... ok. | ||
| + | |||
| + | uninstall-pep-514.reg (86 B) [================================================================================] 100% | ||
| + | Checking hash of uninstall-pep-514.reg ... ok. | ||
| + | python-3.8.2-amd64.exe (26.3 MB) [============================================================================] 100% | ||
| + | Checking hash of python-3.8.2-amd64.exe ... ok. | ||
| + | Running pre-install script... | ||
| + | Running installer script... | ||
| + | Linking ~\scoop\apps\python\current => ~\scoop\apps\python\3.8.2 | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | ' | ||
| + | Notes | ||
| + | ----- | ||
| + | Allow applications and third-party installers to find python by running: | ||
| + | " | ||
| + | Installing ' | ||
| + | python-2.7.17.amd64.msi (19.6 MB) [===========================================================================] 100% | ||
| + | Checking hash of python-2.7.17.amd64.msi ... ok. | ||
| + | Extracting python-2.7.17.amd64.msi ... done. | ||
| + | Linking ~\scoop\apps\python27\current => ~\scoop\apps\python27\2.7.17 | ||
| + | Creating shim for ' | ||
| + | WARN Overwriting shim to python.exe installed from python | ||
| + | Creating shim for ' | ||
| + | WARN Overwriting shim to pythonw.exe installed from python | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | WARN Overwriting shim to idle.bat installed from python | ||
| + | Creating shim for ' | ||
| + | Running post-install script... | ||
| + | DEPRECATION: | ||
| + | Looking in links: c: | ||
| + | Collecting setuptools | ||
| + | Collecting pip | ||
| + | Installing collected packages: setuptools, pip | ||
| + | Successfully installed pip-19.2.3 setuptools-41.2.0 | ||
| + | ' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **Visual Studio** などの外部アプリケーションが **Python** を自動検出できるようにする。\\ | ||
| + | <WRAP prewrap 100% # | ||
| + | < | ||
| + | Allow applications and third-party installers to find python by running: | ||
| + | " | ||
| + | </ | ||
| + | </ | ||
| + | <wrap hi> | ||
| + | <WRAP prewrap 100% # | ||
| + | < | ||
| + | 次のコマンドを実行して、アプリケーションとサードパーティのインストーラーがPythonを見つけられるようにします: | ||
| + | " | ||
| + | </ | ||
| + | </ | ||
| + | 以下のコマンドを実行して、Windows レジストリに **Python** を登録する。\\ | ||
| + | ([[https:// | ||
| + | <WRAP prewrap 100%> | ||
| + | <code powershell> | ||
| + | $ . $env: | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 以下の問い合わせで「はい」をクリックする。\\ | ||
| + | {{python: | ||
| + | |||
| + | 「OK」をクリックする。\\ | ||
| + | {{python: | ||
| + | |||
| + | <WRAP prewrap 100% # | ||
| + | 必要に応じて RegEdit で以下のキーを確認する。\\ | ||
| + | < | ||
| + | HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore | ||
| + | </ | ||
| + | </ | ||
| + | {{python: | ||
| + | |||
| + | **python** の動作確認。\\ | ||
| + | < | ||
| + | $ python -VV | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Python 3.8.2 (tags/ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **python 2.7** へ切り替え。\\ | ||
| + | < | ||
| + | $ scoop reset python27 | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Resetting python27 (2.7.17). | ||
| + | Linking ~\scoop\apps\python27\current => ~\scoop\apps\python27\2.7.17 | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | Creating shim for ' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ python -VV | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Python 3.8.2 (tags/ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Python 公式よりダウンロード ==== | ||
| - [[https:// | - [[https:// | ||
| - ダウンロードした python-3.8.1-amd64.exe を実行して、[Customize installation] をクリックする。 | - ダウンロードした python-3.8.1-amd64.exe を実行して、[Customize installation] をクリックする。 | ||
| 行 128: | 行 272: | ||
| Successfully uninstalled pip-19.2.3 | Successfully uninstalled pip-19.2.3 | ||
| Successfully installed pip-20.0.2 | Successfully installed pip-20.0.2 | ||
| + | </ | ||
| + | - **.py** の拡張子関連付けを **Python 3.8** に設定する。\\ コマンドプロンプトを管理者実行して以下のコマンドを実行する。< | ||
| + | > assoc .py | ||
| + | .py=Python.File | ||
| + | |||
| + | > ftype Python.File | ||
| + | Python.File=" | ||
| + | |||
| + | > ftype Python.File=" | ||
| + | Python.File=" | ||
| </ | </ | ||
| 行 193: | 行 347: | ||
| Python 3.2.3 | Python 3.2.3 | ||
| </ | </ | ||
| + | |||
| + | ===== 参考文献 ===== | ||
| + | [[https:// | ||