PermissionError: [Errno 13] Permission denied: (Pyinstaller)

Viewed 1378
Traceback (most recent call last):
  File "c:\users\me\appdata\local\programs\python\python39\lib\runpy.py", l
ine 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\me\appdata\local\programs\python\python39\lib\runpy.py", l
ine 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\me\AppData\Local\Programs\Python\Python39\Scripts\pyinstal
ler.exe\__main__.py", line 7, in <module>
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\__main__.py", line 126, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\build_main.py", line 815, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\build_main.py", line 762, in build
    exec(code, spec_namespace)
  File "C:\Users\me\Desktop\Game\main.spec", line 23, in <module>
    exe = EXE(pyz,
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\api.py", line 524, in __init__
    self.__postinit__()
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\datastruct.py", line 159, in __postinit__
    self.assemble()
  File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\api.py", line 771, in assemble
    with open(self.name, 'wb') as outf:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\me\\Desktop\\Gam
e\\dist\\main.exe'

Why does it not allow me to make it an executable? I'm using Pyinstaller and I ran pyinstaller --onefile -w main.py.. I tried doing other methods, but none of them worked.

Hopefully somebody can help. :)

Thanks, Dragon

1 Answers

If you are on a Linux machine, try to use the command:

sudo pyinstaller --onefile -w main.py

and if you are on a Windows machine, try to open the cmd using administrator privilege. Just write cmd in the search bar, right-click on the result and chose

open as administrator 
Related