From cccc709c085890633be767a44465229d049d5941 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 13 Feb 2019 13:06:36 +0100
Subject: [PATCH] Do not try to run /usr/bin/python
On modern linux distros, /usr/bin/python will usually either
refer to python2 or not exists at all. Use sys.executable to
run subprocess calls with the same python executable as the
parent process.
---
conda/common/path.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/conda/common/path.py b/conda/common/path.py
index b51f7f272d..06e0b4bc9a 100644
--- a/conda/common/path.py
+++ b/conda/common/path.py
@@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
from functools import reduce
from logging import getLogger
import os
+import sys
from os.path import abspath, basename, expanduser, expandvars, join, normcase, split, splitext
import re
import subprocess
@@ -155,9 +156,11 @@ def parse_entry_point_def(ep_definition):
def get_python_short_path(python_version=None):
if on_win:
return "python.exe"
- if python_version and '.' not in python_version:
+ if not python_version:
+ return sys.executable
+ if '.' not in python_version:
python_version = '.'.join(python_version)
- return join("bin", "python%s" % (python_version or ''))
+ return join("bin", "python" + python_version)
def get_python_site_packages_short_path(python_version):
--
2.19.2