Reputation: 9
c:\program files\python35\scripts> pyinstaller.exe --onefile "path\whatever\main.py"
c:\program files\python35\scripts> pyinstaller --onefile "path\whatever\main.py"
fails to process
also tried running pyinstaller from the path where main.py is located and still nothing.
working with python 3.5.2, 64bit
Thank you
Upvotes: 0
Views: 736
Reputation: 13651
Follow the following steps to create standalone exe
file from a python file.
System Information:
pyinstaller
- 3.3.1Why do we need virtualenv
?
virtualenv
is not a mandatory requirement of creating exe
file. But it is an useful tool to create isolated Python environments for different projects. It keeps the global packages and project specific packages separate. In our case we are keeping pyinstaller
isolate from global installation thus using it in virtual environment.
Install Virtualenv package globally:
pip install --upgrade virtualenv
Create and activate virtual environment:
virtualenv -p python3 venv
source venv/bin/activate (Linux)
venv\Scripts\activate (Windows)
pyinstaller
globally in the machine.
Install Pyinstaller inside the venv
:
pip install pyinstaller
Create exe
file:
pyinstaller main.py -F
Here my python file is called main.py
.
The converted exe can be found in dist
folder.
Upvotes: 2