cx-freeze PermissionError: [Errno 13] Permission denied

后端 未结 3 507
北恋
北恋 2021-01-20 20:18

I am attempting to use cx_Freeze as an alternative to my usual application for converting .py to .exe (auto-py-to-exe). When I run it in cmd I get:

C:\\WINDO         


        
3条回答
  •  醉话见心
    2021-01-20 21:08

    Step 1: Add Python to Windows Path
    Step 2: Open the Windows Command Prompt as administrator
    Step 3: Install the Pyinstaller Package

    In the Windows Command Prompt, type the following command to install the pyinstaller package (and then press Enter):

    pip install pyinstaller
    

    Step 4: Save your Python Script

    I then saved the Python script in the following folder:

    C:\Users\Ron\Desktop\MyPython

    Where I named the Python script as ‘hello’

    Step 5: Create the Executable using Pyinstaller

    Now you’ll be able to create the executable from the Python script using pyinstaller.

    Simply go to the Command Prompt, and then type:

    cd followed by the location where your Python script is stored

    In my case, I typed the following in the command prompt:

    cd C:\Users\Ron\Desktop\MyPython

    Next, use the following template to create the executable:

    pyinstaller --onefile pythonScriptName.py
    

    Since in our example, the pythonScriptName is ‘hello‘, then the command to create the executable is:

    pyinstaller --onefile hello.py
    

    Once you’re done, press Enter for the last time.

    Step 6: Run the Executable

    Your executable should now get created at the location that you specified.

    In my case, I went back to the location where I originally stored the ‘hello’ script

    (C:\Users\Ron\Desktop\MyPython).

    Few additional files got created at that location. To find the executable file, open the dist folder:

    Now I hope that solves the question..

提交回复
热议问题