尝试使用PyInstaller时出现权限错误 [英] Permission Error When Trying to Use PyInstaller
本文介绍了尝试使用PyInstaller时出现权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当尝试使用PyInstaller部署Kivy App时,即使在使用Administrator CMD时,我也收到拒绝权限"错误.该文件夹为每个用户提供所有打开的编辑选项. Python具有防火墙访问权限.该如何解决?
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:\Users\theguy\Documents\Python\myapp-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:\Users\theguy\Documents\Python\myapp-build\myapp.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:\Anaconda3\python.exe
4398 INFO: Caching module hooks...
4402 INFO: Analyzing C:\Users\btdav\Documents\Python\
Traceback (most recent call last):
File "C:\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 101, in <module>
run()
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 213, in __init__
self.__postinit__()
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
self.assemble()
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 415, in assemble
priority_scripts.append(self.graph.run_script(script))
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 201, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "C:\Anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1334, in run_script
with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\theguy\\Documents\\Python\\myapp-build'
推荐答案
技巧是在您要构建的目录之外创建一个新目录,然后像代码中那样使该构建引用Kivy应用程序的main.py.以下.这样可以修复权限错误,甚至是来自常规CMD的错误.
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:\Users\theguy\Documents\Python\myapp-build> python -m PyInstaller --name "MyApp" "C:\Users\theguy\Documents\Python\myapp\main.py"
这篇关于尝试使用PyInstaller时出现权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文