uWSGI 找不到 python3 插件 - open("./python3_plugin.so"): 没有那个文件或目录

uWSGI can't find python3 plugin - open("./python3_plugin.so"): No such file or directory

我已经尝试了 Whosebug 中的所有解决方案,但仍然找不到适合我的解决方案。

正如您在 pluginsdir 中看到的那样 python3 插件可用,但 uwsgi 说它不可用。

[uwsgi] ini 文件

[uwsgi]
vhost = true
plugins-dir = /usr/lib/uwsgi/plugins
plugins = python3
socket = /var/run/domain.org.sock
master = true
enable-threads = true
processes = 2
wsgi-file = /var/www/domain.org/config/wsgi.py
virtualenv = /var/www/domain.org/env
chdir = /var/www/domain.org

ls -la /usr/lib/uwsgi/plugins

drwxr-xr-x 2 root root   4096 Dec 18 21:44 .
drwxr-xr-x 3 root root   4096 Dec 18 21:44 ..
...
-rw-r--r-- 1 root root 199896 Apr 11  2020 python38_plugin.so
lrwxrwxrwx 1 root root     38 Dec 18 21:44 python3_plugin.so -> /etc/alternatives/uwsgi-plugin-python3

uwsgi --ini /etc/uwsgi/apps-available/domain.org.ini

[uWSGI] getting INI configuration from /etc/uwsgi/apps-available/domain.org.ini
open("./python3_plugin.so"): No such file or directory [core/utils.c line 3732]
!!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 2.0.19.1 (64bit) on [Fri Dec 18 21:52:29 2020] ***
compiled with version: 9.3.0 on 18 December 2020 13:15:35

安装完成后,尝试导出并启用python插件;

export PYTHON=python3.8
uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python38"

比将插件文件移动到相关目录;

mv python38_plugin.so /usr/lib/uwsgi/plugins/python38_plugin.so
chmod 644 /usr/lib/uwsgi/plugins/python38_plugin.so

您可以使用如下命令测试插件是否启用;

uwsgi --plugin python38 -s :0

你应该会看到类似的东西;

Python version: 3.8xxx

Ps:如果您遇到类似“权限被拒绝”的错误,请不要忘记在所有命令中添加 sudo。