python:python_install

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:python_install [2020/02/16 13:53] – [Python 2.7/3.8 の共存] ともやんpython:python_install [2020/09/11 16:59] (現在) ともやん
行 1: 行 1:
-<html> 
-  <style> 
-    #result pre { 
-      height: 200px; 
-      overflow: scroll; 
-      overflow-x: hidden; 
-    } 
-  </style> 
-</html> 
 ====== Python のインストール ====== ====== Python のインストール ======
  
行 18: 行 9:
  
 ===== Windows 編 ===== ===== Windows 編 =====
 +
 +==== Scoop によるインストール ====
 +[[windows:scoop|Scoop]] をインストールする。\\
 +ダウンロード元として **versions** バケットを追加する。\\
 +<code>
 +$ scoop bucket add versions
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Checking repo... ok
 +The versions bucket was added successfully.
 +</code>
 +</WRAP>
 +
 +**python**、**python27** をインストールする。\\
 +<code powershell>
 +$ scoop install python python27
 +</code>
 +<WRAP prewrap 100% #result_long>
 +<code powershell>
 +Installing 'lessmsi' (1.6.91) [64bit]
 +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 'lessmsi'.
 +Creating shortcut for Less MSIérables (lessmsi-gui.exe)
 +'lessmsi' (1.6.91) was installed successfully!
 +Installing 'dark' (3.11.2) [64bit]
 +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 'dark'.
 +'dark' (3.11.2) was installed successfully!
 +Installing 'python' (3.8.2) [64bit]
 +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 'python'.
 +Creating shim for 'pythonw'.
 +Creating shim for 'python3'.
 +Creating shim for 'idle'.
 +Creating shim for 'idle3'.
 +'python' (3.8.2) was installed successfully!
 +Notes
 +-----
 +Allow applications and third-party installers to find python by running:
 +"C:\Users\tomoyan\scoop\apps\python\current\install-pep-514.reg"
 +Installing 'python27' (2.7.17) [64bit]
 +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 'python'.
 +WARN  Overwriting shim to python.exe installed from python
 +Creating shim for 'pythonw'.
 +WARN  Overwriting shim to pythonw.exe installed from python
 +Creating shim for 'python2'.
 +Creating shim for 'idle'.
 +WARN  Overwriting shim to idle.bat installed from python
 +Creating shim for 'idle2'.
 +Running post-install script...
 +DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
 +Looking in links: c:\users\tomoyan\appdata\local\temp\tmp1m0br9
 +Collecting setuptools
 +Collecting pip
 +Installing collected packages: setuptools, pip
 +Successfully installed pip-19.2.3 setuptools-41.2.0
 +'python27' (2.7.17) was installed successfully!
 +</code>
 +</WRAP>
 +
 +**Visual Studio** などの外部アプリケーションが **Python** を自動検出できるようにする。\\
 +<WRAP prewrap 100% #mincode>
 +<code>
 +Allow applications and third-party installers to find python by running:
 +"C:\Users\tomoyan\scoop\apps\python\current\install-pep-514.reg"
 +</code>
 +</WRAP>
 +<wrap hi>**重要 (翻訳):**</wrap>\\
 +<WRAP prewrap 100% #mincode>
 +<code>
 +次のコマンドを実行して、アプリケーションとサードパーティのインストーラーがPythonを見つけられるようにします:
 +"C:\Users\tomoyan\scoop\apps\python\current\install-pep-514.reg"
 +</code>
 +</WRAP>
 +以下のコマンドを実行して、Windows レジストリに **Python** を登録する。\\
 +([[https://www.python.org/dev/peps/pep-0514/|PEP 514 -- Python registration in the Windows registry | Python.org]])\\
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ . $env:USERPROFILE\scoop\apps\python\current\install-pep-514.reg
 +</code>
 +</WRAP>
 +
 +以下の問い合わせで「はい」をクリックする。\\
 +{{python:regedit_pep-514_001.png?400|RegEdit Python PEP-514 001}}\\
 +
 +「OK」をクリックする。\\
 +{{python:regedit_pep-514_002.png?400|RegEdit Python PEP-514 002}}\\
 +
 +<WRAP prewrap 100% #mincode>
 +必要に応じて RegEdit で以下のキーを確認する。\\
 +<code>
 +HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore
 +</code>
 +</WRAP>
 +{{python:regedit_pep-514_003.png?640|RegEdit Python PEP-514 003}}\\
 +
 +**python** の動作確認。\\
 +<code>
 +$ python -VV
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
 +</code>
 +</WRAP>
 +
 +**python 2.7** へ切り替え。\\
 +<code>
 +$ scoop reset python27
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Resetting python27 (2.7.17).
 +Linking ~\scoop\apps\python27\current => ~\scoop\apps\python27\2.7.17
 +Creating shim for 'python'.
 +Creating shim for 'pythonw'.
 +Creating shim for 'python2'.
 +Creating shim for 'idle'.
 +Creating shim for 'idle2'.
 +</code>
 +</WRAP>
 +
 +<code>
 +$ python -VV
 +</code>
 +<WRAP prewrap 100% #result>
 +<code>
 +Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
 +</code>
 +</WRAP>
 +
 +
 +==== Python 公式よりダウンロード ====
   - [[https://www.python.org/|Welcome to Python.org]]の[[https://www.python.org/downloads/|Download Python | Python.org]]より最新バージョンをダウンロードしてくる。(ここでは [[https://www.python.org/ftp/python/3.8.1/python-3.8.1-amd64.exe|python-3.8.1-amd64.exe]] を使用する。)   - [[https://www.python.org/|Welcome to Python.org]]の[[https://www.python.org/downloads/|Download Python | Python.org]]より最新バージョンをダウンロードしてくる。(ここでは [[https://www.python.org/ftp/python/3.8.1/python-3.8.1-amd64.exe|python-3.8.1-amd64.exe]] を使用する。)
   - ダウンロードした python-3.8.1-amd64.exe を実行して、[Customize installation] をクリックする。   - ダウンロードした python-3.8.1-amd64.exe を実行して、[Customize installation] をクリックする。
行 129: 行 273:
 Successfully installed pip-20.0.2 Successfully installed pip-20.0.2
 </code> </code>
-  - **.py** の拡張子関連付けを **Python 3.8** に設定する。<code>+  - **.py** の拡張子関連付けを **Python 3.8** に設定する。\\ コマンドプロンプトを管理者実行して以下のコマンドを実行する。<code> 
 +> assoc .py 
 +.py=Python.File
  
 +> ftype Python.File
 +Python.File="C:\Python27\python.exe" "%1" %*
 +
 +> ftype Python.File="C:\Python38\python.exe" "%1" %*
 +Python.File="C:\Python38\python.exe" "%1" %*
 </code> </code>
  
行 196: 行 347:
 Python 3.2.3 Python 3.2.3
 </code> </code>
 +
 +===== 参考文献 =====
 +[[https://github.com/lukesampson/scoop/wiki/Switching-Ruby-And-Python-Versions|Switching Ruby and Python Versions · lukesampson/scoop Wiki]]\\
  
  • python/python_install.txt
  • 最終更新: 2020/09/11 16:59
  • by ともやん