简体   繁体   English

使用pyinstaller将python脚本转换为可执行文件后,我得到:加载共享库时出错...权限被拒绝

[英]After converting python script to executable with pyinstaller I get: error while loading shared libraries… Permission denied

I have a python script which adds a user using the command os.system('useradd user') . 我有一个使用os.system('useradd user')命令添加用户的python脚本。 This code works fine when run like a python script like this sudo python script.py . 当像sudo python script.py这样的python脚本运行时,此代码可以正常工作。 However, once I convert it to executable with pyinstaller with the command python pyinstaller.py --onefile script.py , and run the executable like this sudo ./script , I get an error useradd: error while loading shared libraries: libselinux.so.1: failed to map segment from shared object: Permission denied . 但是,一旦我使用命令python pyinstaller.py --onefile script.py使用pyinstaller将其转换为可执行文件,并像sudo ./script这样运行可执行文件,就会收到错误useradd: error while loading shared libraries: libselinux.so.1: failed to map segment from shared object: Permission denied Any idea what is the issue and how to fix? 任何想法是什么问题以及如何解决?

看起来os.system('sudo useradd user')解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用PyInstaller创建Python可执行文件后,权限被拒绝 - Permission denied after using PyInstaller to create Python executable 将 python 文件转换为可执行文件时出现 Pyinstaller 脚本错误 - Pyinstaller script error when converting a python file into an executable 在Apache2上运行Python脚本时,出现以下错误:IOError:[Errno 13]权限被拒绝 - While running a Python script on Apache2, I get this error: IOError: [Errno 13] Permission denied 使用 PyInstaller 将 python 3.7 脚本转换为 exe 时出错:ModuleNotFoundError - Error while converting python 3.7 script to exe using PyInstaller: ModuleNotFoundError python 子进程 - cygwin 调用 - 加载共享库时出错 - python subprocess - cygwin call - error while loading shared libraries 在另一台机器上运行可执行文件时,PyInstaller 错误加载 Python DLL - PyInstaller error loading Python DLL when running executable on another machine 由于 PyBluez 错误,使用 PyInstaller 创建可执行 python 脚本时出错 - Error creating an executable python script with PyInstaller due to PyBluez error 使用 pyinstaller 创建 Python 可执行文件时未导入库 - Libraries not imported when creating a Python executable with pyinstaller 在 Python 中写入文件时权限被拒绝错误 - Permission denied error while writing to a file in Python 在Jenkins上执行python脚本时,尝试访问串行设备时,为什么会出现“权限被拒绝”错误? - Why do I get a 'permission denied' error when I try to access a serial device when executing python script on Jenkins?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM