[英]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.