LoginSignup
2
4

More than 3 years have passed since last update.

Pythonスクリプトをexe化しよう

Last updated at Posted at 2021-02-17

概要

exe化できれば、python環境インストールされていないPCでも動作させることができるよ。
今回は pyinstaller を使ってexe化しよう。

環境

  • Windows 10 Pro / 20H2 build 19042.804
  • python 3.8.7
  • pip 21.0.1
  • pyinstaller 4.2

前提条件

  • python環境がインストールされていること
  • pipがインストールされていること

pyinstallerをインストール

コマンドプロンプトを開いて以下のコマンドを実行。

pip install pyinstaller

pyinstallerでファイルをexe化

pyinstaller "pythonファイル名" [--onefile] [--noconsole]

オプション

  • --onefile(省略可)
    ファイルを1つにまとめてexeファイルを作成します。

  • --noconsole(省略可)
    コンソール(コマンドプロンプト)の画面を表示しません。

実行結果

実行結果.jpg
exe化を実行すると、上記のようにフォルダ等が作成されます。
"dist"フォルダの中にexeファイルがあります。

2
4
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
2
4