4
1

More than 3 years have passed since last update.

【Windows10】の開発環境をPython3で構築

Last updated at Posted at 2020-01-31

概要

Windows10でPython3をインストールし、開発環境の構築までの流れを自分用にメモ。

システム構成

・Windows(Windows10 64bit)
・Python 3.8.1
・pip 20.0.2
・Virtualenv

1. Python3をインストール

python3.png

上記の公式サイトにアクセスし、Downloadの部分にカーソルを合わせてWindowsを選択してください

今回は、Python 3.8.1をインストールして説明していきます。
Python3パッケージ.png

32bit版Windowsにインストールするなら
Windows x86 web-based installer

64bit版なら
Windows x86-64 web-based installer
をダウンロードしてください

パッケージのインストール

py-install1.png

  1. ダウンロードしたパッケージを実行します。

  2. "Add Python 3.X to PATH"をチェックしてPATHを通します。

  3. Install nowをクリックしインストールします。

Python3のインストールが完了したことを確認

  1. コマンドプロンプト又はPowershellを起動
  2. Pythonのバージョンの確認
コマンドを入力.
 >python -V
このように表示されれば大丈夫です.
  python3.8.1

2.仮想環境の作成

2-1.Virtualenvのインストール

Virtualenvは、pip コマンドでインストールできます。

C:\> py -m pip install virtualenv

今回は仮想環境名をmyvenvとして説明します。

C:\Users\user1> py -m virtualenv myvenv
Using base prefix 'C:\\Users\\user1\\AppData\\Local\\Programs\\Python\\Python36'
New python executable in C:\Users\user1\py3env\Scripts\python.exe
Installing setuptools, pip, wheel...done.

C:\Users\user1\myvenv\ に Python3.8 用の仮想環境が作成されました。

2-2.仮想環境に入る

作成した開発環境名にScripts\activate.batを打ち込んで実行します。

コマンドプロンプトの先頭に(myvenv)と表示されたらOK!!.
C:\Users\user1>myvenv\Scripts\activate
(myvenv) C:\Users\user1>

仮想環境から出る

仮想環境から出るには deactivate コマンドを実行します。

以下のコマンドを入力.
C:\Users\user1>myvenv\Scripts\deactivate
4
1
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
4
1