OCG
OCG

Reputation: 9

pyinstaller failed to process no matter how I try

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

Answers (1)

arshovon
arshovon

Reputation: 13651

Follow the following steps to create standalone exe file from a python file.

System Information:

  • Operation system: Windows 8
  • Python: 3.6.2
  • Package: pyinstaller - 3.3.1

Why 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)


If you find it too complex, you can do the following steps even without performing the above steps. It will install 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

Related Questions