From 9b789e58284e9bbfc1a94f67df3badd1fcb4da01 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 18 Sep 2022 13:58:46 -0700 Subject: [3.11] gh-96861: Check for unset sys.executable during venv creation. (GH-96887) (GH-96919) (cherry picked from commit 2cd70ffb3fe22d778d0bb6ec220fdf67dccc1be6) --- Lib/venv/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 6032f36..f5570e8 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -128,6 +128,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 -- cgit v0.12