如何确定解释器正在使用哪个Python安装? [英] How to determine which Python install is being used by the interpreter?

查看:144
本文介绍了如何确定解释器正在使用哪个Python安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个软件包可以安装各种Python版本.例如:

I have several software packages that install various installs of Python. For example:

C:\Python27\ArcGIS10.1
C:\Python27\ArcGIS10.2
C:\Python27|ArcGISx6410.1

使用sys.version不适用于我的情况,因为我需要知道实际安装的位置,而不是版本.

Using sys.version does not work for my case since I need to know where the actual install is located, not the version.

如何确定我的Python解释器正在使用哪个安装?

How can I determine which install my Python interpreter is using?

推荐答案

您想要的是 sys.executable ,它将提供实际解释程序可执行文件的路径.

What you want is sys.executable, which will give the path to actual interpreter executable.

这篇关于如何确定解释器正在使用哪个Python安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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