如何在uwsgi进程中获取python解释器路径 [英] How to get python interpreter path in uwsgi process

查看:681
本文介绍了如何在uwsgi进程中获取python解释器路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在uwsgi进程中获取python解释器路径(如果我使用-h参数启动它)?我尝试使用VIRTUAL_ENV和UWSGI_PYHOME环境变量,但是它们是空的,我不知道为什么.我也尝试使用sys.executable,但是它指向uwsgi进程路径.

How can I get python interpreter path in uwsgi process (if I started it with -h parameter)? I tryed to use VIRTUAL_ENV and UWSGI_PYHOME environment variables, but they are empty, I do not know why. Also i tryed to use sys.executable, but it points to uwsgi process path.

推荐答案

uWSGI不是python应用程序(它仅调用libpython函数),因此有效的可执行文件是uwsgi二进制文件.如果使用virtualenvs,则可以假定二进制文件位于venv/bin/python

uWSGI is not a python application (it only calls libpython functions) so the effective executable is the uwsgi binary. If you use virtualenvs you can assume the binary is in venv/bin/python

这篇关于如何在uwsgi进程中获取python解释器路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆