From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 18 Sep 2022 20:53:04 +0000 (-0700) Subject: [3.10] gh-96861: Check for unset sys.executable during venv creation. (GH-96887)... X-Git-Tag: v3.10.8~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f4be544a0317fba25fad1e8a13d7f9f2f58f177d;p=thirdparty%2FPython%2Fcpython.git [3.10] gh-96861: Check for unset sys.executable during venv creation. (GH-96887) (GH-96918) (cherry picked from commit 2cd70ffb3fe22d778d0bb6ec220fdf67dccc1be6) Co-authored-by: Vinay Sajip Co-authored-by: Vinay Sajip --- diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 6f1af294ae63..885200851535 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -115,6 +115,11 @@ class EnvBuilder: context.prompt = '(%s) ' % prompt create_if_needed(env_dir) executable = sys._base_executable + if not executable: # see gh-96861 + raise ValueError('Unable to determine path to the running ' + 'Python interpreter. Provide an explicit path or ' + 'check that your PATH environment variable is ' + 'correctly set.') dirname, exename = os.path.split(os.path.abspath(executable)) context.executable = executable context.python_dir = dirname