1
1

More than 1 year has passed since last update.

PythonプログラムのexeするためにPyinstallerを使用する(Pyinstallerの使い方について)

Posted at

こんにちは。YoutubeやTwitchで配信しておりますアニメ、漫画、ゲーム、Vtuber大好きオタクのVtuber
久遠楽 (https://twitter.com/kuonraku0210) です
今回はpythonで作成したスクリプトをexeに変換することでpythonが入っていない環境でも実行できるようにします
備忘録として記載してあるので足りない箇所などがあるかと思います
その際がご指摘いただければ幸いです

環境

  • OS:Windows 10 64bit
  • Python 3.11.2
  • PyInstaller 5.8.0

1.PyInstallerをインストール

コマンドプロンプトを起動し以下のコードを入力

pip install pyinstaller

2.作成したpythonファイルをexeファイルへ変換

1.コマンドプロンプトを開き作成したpythonファイルがある階層に移動
2.pyinstallerでpythonファイルをexeファイルに変換

>cd pythonファイルがあるディレクトリ
>pyinstaller pythonファイル.py --onefile --noconsole

そうするとフォルダ内に以下3つのものが作成されます

  • build
  • dist
  • pythonファイル名.spec

dist内にあるexeファイルを実行すれば処理が動きます

3.最後に

これでPythonが入っていないPCでも実行することが可能になりましたので
放置してデータを収集したいと思います。

【宣伝】
APEXやヴァロラントなどのFPSをメインに毎日20時頃から配信をしているのでよければチャンネル登録していただければ嬉しいです。

1
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
1
1