Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在uwsgi进程中获取python解释器路径_Python_Path_Environment Variables_Interpreter_Uwsgi - Fatal编程技术网

如何在uwsgi进程中获取python解释器路径

如何在uwsgi进程中获取python解释器路径,python,path,environment-variables,interpreter,uwsgi,Python,Path,Environment Variables,Interpreter,Uwsgi,如何在uwsgi进程中获取python解释器路径(如果我使用-h参数启动它)?我试图使用VIRTUAL_ENV和UWSGI_PYHOME环境变量,但它们是空的,我不知道为什么。我还尝试使用sys.executable,但它指向uwsgi进程路径。uwsgi不是python应用程序(它只调用libpython函数),因此有效的可执行文件是uwsgi二进制文件。如果您使用virtualenvs,您可以假设二进制文件在venv/bin/python中您想要的不是sys.path?我需要解释器路径,比如

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

uwsgi不是python应用程序(它只调用libpython函数),因此有效的可执行文件是uwsgi二进制文件。如果您使用virtualenvs,您可以假设二进制文件在venv/bin/python中

您想要的不是
sys.path
?我需要解释器路径,比如“/home/user/envs/project/bin/python”,而不是导入路径。我明白了,也许您知道获取virtualenv文件夹的方法?uwsgi.opt['virtualenv']是的,谢谢。只有密钥的名称是
home
,而不是
virtualenv
。修正:
uwsgi.opt['home']
如果你没有使用virtualenv怎么办?那么如何获得python解释器的路径呢?