LoginSignup
1
0

More than 1 year has passed since last update.

python exe化

Last updated at Posted at 2021-12-06

こちらを参考に
https://techacademy.jp/magazine/18963

anaconda prompt を起動し

pip install pyinstaller
を実行する。

最後に警告がでる
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
You should consider upgrading via the 'C:\Users\rie-s\anaconda3\python.exe -m pip install --upgrade pip' command.

とあるので,書いてある通り

C:\Users\rie-s\anaconda3\python.exe -m pip install --upgrade pip

のコマンドを入力すると,なんかめっちゃエラーでる
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\rie-s\AppData\Roaming\Python\Python38\site-packages\pip_internal\cli\base_command.py", line 180, in _main
status = self.run(options, args)

pipのアップデートしてみる

pip install -U pip

同じエラーがでる。

spyder を終了してやってみる。→変わらずエラー

警告だったので,とりあえずexe化を試してみる。

pyinstaller MeasureJudge.py

結構時間かかる。5分くらい?
buildとdistというフォルダが作成される。
dist\MeasureJudge.exe ファイルが作成されている。

pyinstaller MeasureJudge.py --onefile
オプション--onefileで単体EXEを作成

いらないライブラリは--exclude-module panda で除ける。
pyinstaller --onefile --exclude-module numpy --exclude-module pandas example.py

コンソール非表示
--noconsole

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