PyInstaller reads your Python program, analyzes all the imports that it makes, and then binds copies of those to the program.
You can install it through pip using this command: Pip install pyinstaller Usage: pyinstaller path_to_your_script.py PyInstaller reads your Python program, analyzes all the imports it makes, and binds copies of those to the program. The user can launch the integrated application without having to install a Python interpreter or other modules.
A command-line interface is a tool through which the user can interact with a program. Users can run the necessary commands and pass system arguments to the code and the response is generated as per written in the program.
How to use python to build a single executable file
If we need to share some function to the users who can’t code, we need to build a single executable file to them. In this case, we can use the package, ‘pyinstaller’, bundles a Python application and all its dependencies into a single package.
Install Virtualenv
pyinstaller only support 2.7 or 3.3-3.5, so we need an environment for build up our code.
pip install virtualenv
We also can use pycharm to setup the environment.
Create a new project
Select “Create VirtualEnv”
Enter your virtualenv information
Create the project
Build code by pyinstaller
The very important thing is that the executable file can’t run on different platforms. That means you only can run the code with compiler platform.
Can I use PyInstaller as a cross-compiler?
Can I package Windows binaries while running under Linux?
No, this is not supported. Please use Wine for this, PyInstaller runs fine in Wine. You may also want to have a look at this thread in the mailinglist. In version 1.4 we had build in some support for this, but it showed to work only half. It would require some Windows system on another partition and would only work for pure Python programs. As soon as you want a decent GUI (gtk, qt, wx), you would need to install Windows libraries anyhow. So it's much easier to just use Wine.
Can I package Windows binaries while running under OS X?
No, this is not supported. Please try Wine for this.
Can I package OS X binaries while running under Linux?
This is currently not possible at all. Sorry! If you want to help out, you are very welcome.
The command is very easy if you wanna build a single file
wget https://github.com/pyinstaller/pyinstaller/releases/download/3.0/PyInstaller-3.0.tar.gz
tar xzvf PyInstaller-3.0.tar.gz
# El siguiente sed permite usarlo como root
sed -i '110i\ \ \ \ return True' PyInstaller-3.0/PyInstaller/utils/misc.py
cd PyInstaller-3.0/bootloader/
# borrar lineas 289 y 290 de wscript que agrega el -m32
sed -i '289 s/^/#/' wscript
sed -i '290 s/^/#/' wscript
# la compilacion anterior requiere zlib, en caso de que tire error -lz falta zlib-dev
### en ubuntu 14.04 se soluciona con: # aptitude install zlib1g-dev
python waf distclean --no-lsb all
cd ../
python setup.py install
I’m trying to package a test Python project using PyInstaller. The full source is available at https://github.com/xilanma/ohoh
All it does is import the aes and ecdsa module. When trying to package on Windows using PyInstaller, it builds the .exe but when I launch the .exe, I get the following error:
C:\Users\ixcoin\dev\ohoh\dist>ohoh.exe trying to import aes Traceback (most recent call last):…
py2exe 로 만든 파일을 dropbox에 올리고, 크롬에서 다운로드 하는데 계속 악성파일로 인식됐다. 혹시 code signing 을 하면 괜찮을까 싶어서 해보니 py2exe는 code signing 지원이 안된다. 그러다가 PyInstaller 를 알게 됐는데, 훨씬 간편하다. 결과 exe 파일 크기도 더 작다. 실행시 warning이 뜨는데, 이건 아래 url 답변중에 build.py 파일 변경하라는 답변을 적용하니 해결됨.