# Detect a suitable Python binary to use.
def find_python_binary
if Gem.win_platform?
return %w[py -3] if which('py')
return [%w[python3 python].find { |py| !which(py).nil? }]
end
# On non-Windows platforms, we simply rely on shebang
[]
end
This code prefers the outcome of py -3, which bypasses any active virtual environment. This is very inconvenient when using custom lexers, since you have to install them into a system python.
This code prefers the outcome of
py -3
, which bypasses any active virtual environment. This is very inconvenient when using custom lexers, since you have to install them into a system python.