Skip to content

Commit

Permalink
Specify python binary path (#3507)
Browse files Browse the repository at this point in the history
  • Loading branch information
kephircheek committed Jan 20, 2023
1 parent 91e1e13 commit 4a7185f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autoload/black.vim
Expand Up @@ -34,7 +34,7 @@ FLAGS = [
]


def _get_python_binary(exec_prefix):
def _get_python_binary(exec_prefix, pyver):
try:
default = vim.eval("g:pymode_python").strip()
except vim.error:
Expand All @@ -43,7 +43,7 @@ def _get_python_binary(exec_prefix):
return default
if sys.platform[:3] == "win":
return exec_prefix / 'python.exe'
return exec_prefix / 'bin' / 'python3'
return exec_prefix / 'bin' / f'python{pyver[0]}.{pyver[1]}'

def _get_pip(venv_path):
if sys.platform[:3] == "win":
Expand Down Expand Up @@ -82,7 +82,7 @@ def _initialize_black_env(upgrade=False):
_executable = sys.executable
_base_executable = getattr(sys, "_base_executable", _executable)
try:
executable = str(_get_python_binary(Path(sys.exec_prefix)))
executable = str(_get_python_binary(Path(sys.exec_prefix), pyver))
sys.executable = executable
sys._base_executable = executable
print(f'Creating a virtualenv in {virtualenv_path}...')
Expand Down

0 comments on commit 4a7185f

Please sign in to comment.