我可以使用"nginx -s reload"命令在 shell 上重新启动 nginx。但是,当我使用os.system("nginx -s reload")命令时,它出现错误。
/usr/local/bin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
对于这个错误。我已经安装了pcre。是否有一些魔法问题。
要在 python 脚本中运行此类命令,最好使用subprocess library。
试试这个代码而不是你的:
import subprocess
subprocess.call('whatever command you want to run it in terminal', shell=True)
Run Code Online (Sandbox Code Playgroud)
幸运
| 归档时间: |
|
| 查看次数: |
1277 次 |
| 最近记录: |