Make Python scripts into Windows-executable .exes with Pyinstaller

Make your Python script an .exe that can be run on Windows

Previously, you had to write setup.py, such as py2exe and CX_Freeze. Recently, it seems that PyInstaller is recommended, so I tried it.

Installation

pip install pyinstaller

Target script

C:\Users\kounoike\Documents\python\installer-test>type hello.py
#!python
# coding: utf-8

print "hello world"

C:\Users\kounoike\Documents\python\installer-test>python hello.py
hello world

Create .exe

pyinstaller hello.py

only this. No troublesome setup.py description. Hello.exe and necessary libraries are created under dist \ hello.

problem

It seems that it takes in too many packages compared to py2exe etc.

#!python
# coding: utf-8

import matplotlib.pyplot as plt

print "hello world"

Just by rewriting, dist and below will swell to 100MB. If you look at it, you can see that IPython, QT4, OpenGL, and other extra things are mixed in.

So it's virtualenv.

So let's use virtualenv. Please refer to http://qiita.com/kounoike/items/14bfd7c328be0d69c770 etc.

There is one caveat when using PyInstaller with virtualenv. Let's install pywin32 with easy_install.

Postscript @ 2015/07/21

After all, if you put it in the Japanese folder, it will not work well ...

Why is it okay with a network drive?

Recommended Posts

Make Python scripts into Windows-executable .exes with Pyinstaller
Make JSON into CSV with Python from Splunk
Make a CSV formatting tool with Python Pandas PyInstaller
Make Puyo Puyo AI with Python
Make a fortune with Python
[Python] Make AWS resources mocked with Moto into pytest fixtures
Make Echolalia LINEbot with Python + heroku
Make apache log csv with python
Let's make a GUI with python.
Make a recommender system with python
Utilize Python custom scripts with StackStorm
Let's make a graph with python! !!
Make Scrapy an exe with Pyinstaller
Make multiple numerical elevation data into a single picture with Python
Make the Python console covered with UNKO
INSERT into MySQL with Python [For beginners]
Let's make a shiritori game with Python
Suddenly with Python PyInstaller No module named pyinstaller
Automatic update method with python Pyinstaller exe
Put protocol buffers into sqlite with python
Fractal to make and play with Python
Let's make a voice slowly with Python
Make pypy submission easier with atcoder-cli (python)
[Python] Let's make matplotlib compatible with Japanese
Let's make a web framework with Python! (1)
Make a desktop app with Python with Electron
Let's make a Twitter Bot with Python!
Let's make a web framework with Python! (2)
Make a Twitter trend bot with heroku + Python
Automatically check Python scripts with GitHub + Travis-CI + pycodestyle
[Python] Make a game with Pyxel-Use an editor-
I want to make a game with Python
Try to make a "cryptanalysis" cipher with Python
Automatically format Python code into PEP8-compliant code with Emacs
Make OpenCV3 available from python3 installed with pyenv
Make your own module quickly with setuptools (python)
[Python] Make a simple maze game with Pyxel
Let's replace UWSC with Python (5) Let's make a Robot
Try to make a dihedral group with Python
Make holiday data into a data frame with pandas
[Python] Expression (1,2) does not make tuples with parentheses
Make Python built with jhbuild work on OSX
Make your Python environment "easy" with VS Code
[# 1] Make Minecraft with Python. ~ Preliminary research and design ~
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
Excel with Python
Microcomputer with Python
Cast with python