0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

.pyを.exe化する方法2

Posted at

初めに

本記事ではPythonの.pyファイルをwindowsの実行形式.exeに変換する方法を紹介します。

必要なもの

  • exe化したいpythonファイル(拡張子が.py)
  • pythonコマンドがターミナルで使用できる環境
    pipやpythonのインストール方法は紹介しません。

事前準備

今回はpyinstallerを使用するのでpipコマンドでインストールします。

cmd
pip install pyinstaller

pyinstallerの使用方法は基本的に以下の通りです

cmd
pyinstaller <exe化したいpyファイル>
option disc
--noconsole コンソール画面を非表示にする
--icon exeファイルのアイコンを指定する
--onefile 複数ファイルを一つのexeにまとめる
--key 難読化

ここではtest.pyを元に使用します

C:\>pyinstaller test.py

すると文字がたくさん出てくるのでINFO: Build complete! と出力されるまで待ちます。

完成した.exeファイルは./dist/に出力されています。
_internal内に依存ファイルなどあるため消さずに残しましょう

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?