]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] gh-96861: Check for unset sys.executable during venv creation. (GH-96887)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 18 Sep 2022 20:53:04 +0000 (13:53 -0700)
committerGitHub <noreply@github.com>
Sun, 18 Sep 2022 20:53:04 +0000 (21:53 +0100)
(cherry picked from commit 2cd70ffb3fe22d778d0bb6ec220fdf67dccc1be6)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Lib/venv/__init__.py

index 6f1af294ae63e367967cd1e655cbd6118bae5b24..88520085153579a62f348a2298f360a6ac0b2ae5 100644 (file)
@@ -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