Configure Pycharm to launch Pyinstaller

Yes, I want to create a launch configuration in PyCharm in order to start Pyinstaller and get my executable. According to the Pyinstaller documentation, you should be able to find a python script named pyinstaller-folder/pyinstaller.py after installation, but it wasn't there. Then I looked carefully and found another pyinstaller-folder/__main__.py named pyinstaller-folder/__main__.py which should be the same <- (I guess), so I set up my working configuration like this:

enter image description here

After starting, it gives this error:

 /usr/local/Cellar/python3/3.4.3/bin/python3.4 /usr/local/lib/python3.4/sit e-packages/PyInstaller/__main__.py --onefile --nowindow --osx-bundle-identifier=jg.optimizer -F --name=genoptimizer optimizer/manage.py Traceback (most recent call last): File "/usr/local/lib/python3.4/site-packages/PyInstaller/__main__.py", line 26, in <module> from . import __version__ SystemError: Parent module '' not loaded, cannot perform relative import Process finished with exit code 1 

It seems like a parent module is required to run, but what will it look like?

+15
source share
6 answers

The PyInstaller package is an executable module and can be launched using python -m PyInstaller . To configure it as the launch target in PyCharm, leave the "Script" field blank, type -m PyInstaller in the "Interpreter Settings" field and put the PyInstaller parameters in the "Script Parameters" field.

For instance:

pyinstaller pycharm configuration

PyCharm will complain that the "Script" field is empty, but it will still allow you to start the configuration.

+17
source

After more than two years, there may be a better option.

From the PyCharm menu, go to File โ†’ Settings.
In the Preferences dialog box, find Tools โ†’ External Tools and use green + to add a new external tool.

For instance:

enter image description here

Then the IDE will let you run it on any Python script. Right-click on the file and External Tools โ†’ PyInstaller will appear in the context menu.

+14
source

Since Pycharm recently had updates, my case was slightly different since I installed pyinstaller from the interpreter settings, as shown in the following figure:

enter image description here

For Linux users :

You can install it in both Python 2.7 and Python 3.7+ . Make sure that the pyinstaller found the path to the pyinstaller pyinstaller Then, in the "Settings" parameter, find "Tools โ†’ External Tools" and add a new external tool, as shown in the following figure: enter image description here

For Windows users :

If you are using Pycharm or any virtual environment. Unfortunately, Pycharm creates its local vertical environment on the venv path only you specify an interpreter . So you have to install the external tool (pyinstaller) on the real path of your python 3.7.exe, as shown in the picture here

+1
source

For those of us working on Windows with Anaconda trying to figure this out, the easiest way for me was to configure the Bash configuration (I think you need the BashSupport plugin for this) and install:

  • Script: pyinstaller (assuming pyinstaller is in your path, if not, full path)
  • Interpreter path: C:\Windows\system32\cmd.exe (yes, the Bash configuration can just use the standard command program)
  • Interpreter Options: /C
  • Program arguments: script_name.py (along with any other pyinstaller arguments)
  • Working Directory: C:\Path\To\Script
0
source

Install pyinstaller in pycharm, then open the pycharm terminal and write python -m PyInstaller .

0
source

output for pyinstaller on pycharm 8 windows

 argumento fails --- V -y -FV -y -F --onefile V -y -F --onefile -c $FileName$ F (default path) -y -F --onefile -w $FileName$ F (default path, no console neither cmd) -y -F --onefile -c $FileName$ --distpath $FileDir$ F (path as project) -y -F --onefile -c $FileName$ --distpath $FileRelativePath$ V best selection -> line four or six 
-1
source

All Articles