Configuring Pycharm to run Pyinstaller

后端 未结 7 1563
情深已故
情深已故 2020-12-13 11:01

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 pyth

相关标签:
7条回答
  • 2020-12-13 11:33

    output for pyinstaller on pycharm windows 8

    argumento                                                        fails
    ---                                                                V
    -y -F                                                              V
    -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
    
    0 讨论(0)
  • 2020-12-13 11:34

    For those of us on Windows with Anaconda trying to figure this out, I found it easiest to just set up a Bash Configuration (I believe you need the BashSupport plugin for this), and set:

    • Script: pyinstaller (assuming pyinstaller is in your path, if not, the full path)
    • Interpreter path: C:\Windows\system32\cmd.exe (yes, a 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 讨论(0)
  • 2020-12-13 11:40

    The run command has changed a bit since the accepted answer. You can now select a module to launch rather than editing the interpreter options.

    As of writing this answer, here is how it looks like:

    Notes:

    • This solution requires to install PyInstaller in the virtual environment of the project.
    • I am using PyCharm pro 2020.1
    • Old solution should still work
    • Using external tool is still a possibility. Which solution you choose is a matter of personal preference.
    0 讨论(0)
  • 2020-12-13 11:44

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

    0 讨论(0)
  • 2020-12-13 11:49

    So as Pycharm has newly updates, my case was a bit different as I installed pyinstaller from the interpreter settings as the following picture shows:

    For Linux Users:

    You could install it in both Python 2.7 or Python 3.7+. Make sure to get the path of where pyinstaller was stored.Then in the Settings option, try to find Tools -> External tools and add a new external tool as the following picture shows:

    For Windows users:

    If you are using Pycharm or any virtual environment. Unfortunatelly Pycharm creates its local vertual environment in venvpath once you indicate the interpreter. So, you should set the external tool (pyinstaller) to the real path of your python 3.7 .exe as the picture shows

    0 讨论(0)
  • 2020-12-13 11:50

    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:

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

    0 讨论(0)
提交回复
热议问题