Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python 3.x - Permission Error When Trying to Use PyInstaller

When trying to deploy a Kivy App using PyInstaller, I am getting Permission Denied errors even when using and Administrator CMD. The folder has all open editing options for every user. Python has firewall access. How to fix this?

PS C:UsersheguyDocumentsPythonmyapp-build> python -m PyInstaller --name "MyApp" "./"
422 INFO: PyInstaller: 3.3.1
422 INFO: Python: 3.6.5
424 INFO: Platform: Windows-10-10.0.17134-SP0
425 INFO: wrote C:UsersheguyDocumentsPythonmyapp-buildmyapp.spec
426 INFO: UPX is not available.
427 INFO: Extending PYTHONPATH with paths
['C:\Users\theguy\Documents\Python',
 'C:\Users\theguy\Documents\Python\myapp-build']
428 INFO: checking Analysis
428 INFO: Building Analysis because out00-Analysis.toc is non existent
429 INFO: Initializing module dependency graph...
432 INFO: Initializing module graph hooks...
434 INFO: Analyzing base_library.zip ...
3859 INFO: running Analysis out00-Analysis.toc
3861 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:Anaconda3python.exe
4398 INFO: Caching module hooks...
4402 INFO: Analyzing C:UserstdavDocumentsPython
Traceback (most recent call last):
  File "C:Anaconda3lib
unpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:Anaconda3lib
unpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:Anaconda3libsite-packagesPyInstaller\__main__.py", line 101, in <module>
    run()
  File "C:Anaconda3libsite-packagesPyInstaller\__main__.py", line 94, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:Anaconda3libsite-packagesPyInstaller\__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:Anaconda3libsite-packagesPyInstalleruildinguild_main.py", line 791, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:Anaconda3libsite-packagesPyInstalleruildinguild_main.py", line 737, in build
    exec(text, spec_namespace)
  File "<string>", line 16, in <module>
  File "C:Anaconda3libsite-packagesPyInstalleruildinguild_main.py", line 213, in __init__
    self.__postinit__()
  File "C:Anaconda3libsite-packagesPyInstalleruildingdatastruct.py", line 161, in __postinit__
    self.assemble()
  File "C:Anaconda3libsite-packagesPyInstalleruildinguild_main.py", line 415, in assemble
    priority_scripts.append(self.graph.run_script(script))
  File "C:Anaconda3libsite-packagesPyInstallerdependanalysis.py", line 201, in run_script
    self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
  File "C:Anaconda3libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1334, in run_script
    with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'C:\Users\theguy\Documents\Python\myapp-build'
See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Trick is to make a new directory outside of the one you are building, and then make the build reference the main.py of the Kivy app like in the code below. This fixes permission errors, even from a regular CMD.

PS C:UsersheguyDocumentsPythonmyapp-build> python -m PyInstaller --name "MyApp" "C:UsersheguyDocumentsPythonmyappmain.py"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...