uwsgi,用定制的python安装构建python插件

2024-10-03 00:29:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我想从目录/opt/python36下的定制python安装为uwsgi构建python_插件。 如何在构建时设置到该python的路径? 我运行命令bellow,但是这个插件是用oscent7附带的python2.7组装的。在

PYTHON=python3.6; /usr/sbin/uwsgi  --build-plugin 
"/usr/src/uwsgi/2.0.15/plugins/python/ python36" 

Tags: 命令build路径src目录插件usrplugin
2条回答

我用了肮脏的解决方案。我临时用定制的python替换了附带的python,编译uwsgi插件,然后将附带的python放回去。在

rm -f /usr/bin/python; ln -s  /opt/python3/bin/python3 /usr/bin/python;  # set correct python

PYTHON=python3.6; /usr/sbin/uwsgi   build-plugin "/usr/src/uwsgi/2.0.15/plugins/python/ python36" # commpile uwsgi plugin

strings  python36_plugin.so|grep '3.6' # test python version

chmod 644 ./python36_plugin.so ; mv ./python36_plugin.so  /usr/lib64/uwsgi/;

rm -f /usr/bin/python; ln -s  /usr/bin/python2  /usr/bin/python #  > set back shipped python

只需cd到所需的目录:

cd /opt/python36 && uwsgi  build-plugin "/usr/src/uwsgi/plugins/python python36"

相关问题 更多 >