Determine Which Interpreter is Being Used by the Python Adapter

Updated Sep 10, 2019

Reported In

Software

  • TestStand

Issue Details

I am getting unresolvable errors and would like to know which Python interpreter is being referenced by the Python Adapter in TestStand. How can I do this? 

Solution

You can determine which interpreter the Python adapter is using by executing a code module which returns sys.prefix.

An example module would look as follows:

import sys.prefix
def python_interpreter_path() :
return sys.prefix

The return value contains the path of the Python being used. This technique also works for virtual environments and will return the path to the virtual environment.