cx-freeze PermissionError: [Errno 13] Permission denied

后端 未结 3 505
北恋
北恋 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 20:57

    dude you are running the command from system32

    cd to another directory using this command and try again

    cd C:/Users/<your name>/Documents
    

    if this doesnt work go here

    0 讨论(0)
  • 2021-01-20 20:58

    Read this doc. Create a setup.py file in your project directory and copy the content from the docs into it.

    Modify it as necessary, then run python setup.py build inside your project directory.

    0 讨论(0)
  • 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..

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