Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
796 views
in Technique[技术] by (71.8m points)

python - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After more than two years, perhaps there is a better option.

In the PyCharm menu go to File -> Settings.
In the Settings dialog find Tools -> External tools and use the green + to add a new external tool.

For example:

enter image description here

Then, the IDE will allow you to run it on any python script. Right click on the file and the context menu will show External tools -> PyInstaller.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...