LoginSignup
0
0

More than 5 years have passed since last update.

【今さら】python2.7->python3系への切り替え(windows)

Posted at

はじめに

windowsに初期で入っているpython2.7の設定が逐一読み込まれて手間なので、
それをpython3系に変更したい場合のメモ

手順1-pythonのインストールパスを確認

コマンド

$ which python
/c/Python27/python #Cドライブ直下に存在
$ which python3
which: no python3 in (/mingw64/bin:/usr/bin:/c/Users/user/bin:/c/Python27:/c/Python27/Scripts:/c/ProgramData/Boxstarter:...)
# path情報の全量が表示されたものの、python3に関するpathはないようだ。

手順2. python3のインストール

pythonのインストールページに行き、
(32bitPC)Windows x86 web-based installer
(64bitPC)Windows x86-64 web-based installer
をインストール。
これはインストーラファイルなので、ダウンロード後に実行する。
py-install1.png

手順3. python3のpathを通す。

上画像のチェックボックスを入れて実行する。

手順4 python2.7のpathを消して、python3のpathを通す

実行後、以下のpathが通る。

- C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\
- C:\Users\user\AppData\Local\Programs\Python\Python37\

その設定をユーザ環境変数、システム環境変数のPath覧に追加する。
environment_variable01.png

確認

$ python
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0