pythonpython-3.xpycharmosx-yosemitepyinstaller

Configuring Pycharm to run Pyinstaller


Yes I want to create a run configuration in PyCharm to run Pyinstaller and get my executable. According to the Pyinstaller documentation you should be able to locate an python script called pyinstaller-folder/pyinstaller.py after the installation, but it wasn't there. Then I look carefully and found this other one named pyinstaller-folder/__main__.py which should be the same <--(me wild guessing), so I set up my running configuration like this:

enter image description here

After running it, is giving me 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 to require a parent module to run but, how would that look like?


Solution

  • The PyInstaller package is a runnable module and can be run using python -m PyInstaller. To configure it as a run target in PyCharm, leave the "Script" field blank, write -m PyInstaller in the "Interpreter Options" field, and put the PyInstaller parameters into the "Script Parameters" field.

    For example:

    pyinstaller pycharm configuration

    PyCharm will complain that the "Script" field is empty, but it will let you run the configuration anyway.