东方魄 发表于 2020-4-19 15:18:39

Mac下,pyinstaller打包文件老是显示权限不许可,求助!!!

PermissionError: Operation not permitted: '/Users/yangbo/Desktop/dist/b'

dist文件夹,和源文件b.py均在桌面

在bash下输入以下,就会出现上述情况:
:$ chmod a+x /Users/yangpo/Desktop/b.py
:~ yangpo$ cd Desktop
r:Desktop yangpo$ pyinstaller -F b.py

txxcat 发表于 2020-4-19 16:37:03

权限不够在命令前面加上sudo,根据提示输入管理员密码。

东方魄 发表于 2020-4-19 16:45:56

txxcat 发表于 2020-4-19 16:37
权限不够在命令前面加上sudo,根据提示输入管理员密码。

还是不行...出现同样的错误

东方魄 发表于 2020-4-19 16:52:58

txxcat 发表于 2020-4-19 16:37
权限不够在命令前面加上sudo,根据提示输入管理员密码。

sudo pyinstaller -F b.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 734, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 681, in build
    exec(code, spec_namespace)
File "/Users/heliang/Desktop/b.spec", line 20, in <module>
    exe = EXE(pyz,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 445, in __init__
    self.__postinit__()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
    self.assemble()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 522, in assemble
    os.remove(self.name)
PermissionError: Operation not permitted: '/Users/yangbo/Desktop/dist/b'

txxcat 发表于 2020-4-19 17:25:55

东方魄 发表于 2020-4-19 16:52
sudo pyinstaller -F b.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.f ...

不要在桌面打包文件,试试在yangbo下再建立一个目录,把b.py拷到新目录下打包。

东方魄 发表于 2020-4-20 11:23:09

txxcat 发表于 2020-4-19 17:25
不要在桌面打包文件,试试在yangbo下再建立一个目录,把b.py拷到新目录下打包。

搞定,谢谢!想不通,为啥在桌面上会显示权限不允许

txxcat 发表于 2020-4-20 11:45:32

东方魄 发表于 2020-4-20 11:23
搞定,谢谢!想不通,为啥在桌面上会显示权限不允许

桌面属于系统文件夹, 多多少少有些权限限制,pyinstaller打包中要生成一些新文件和文件夹,删除一些临时文件和文件夹,貌似MAC系统为了安全做了限制导致出错。

东方魄 发表于 2020-4-23 17:34:02

txxcat 发表于 2020-4-20 11:45
桌面属于系统文件夹, 多多少少有些权限限制,pyinstaller打包中要生成一些新文件和文件夹,删除一些临时 ...

明白了,谢谢
页: [1]
查看完整版本: Mac下,pyinstaller打包文件老是显示权限不许可,求助!!!