Skip to content

Commit f4be544

Browse files
[3.10] gh-96861: Check for unset sys.executable during venv creation. (GH-96887) (GH-96918)
(cherry picked from commit 2cd70ff) Co-authored-by: Vinay Sajip <[email protected]> Co-authored-by: Vinay Sajip <[email protected]>
1 parent a978e2f commit f4be544

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/venv/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def create_if_needed(d):
115115
context.prompt = '(%s) ' % prompt
116116
create_if_needed(env_dir)
117117
executable = sys._base_executable
118+
if not executable: # see gh-96861
119+
raise ValueError('Unable to determine path to the running '
120+
'Python interpreter. Provide an explicit path or '
121+
'check that your PATH environment variable is '
122+
'correctly set.')
118123
dirname, exename = os.path.split(os.path.abspath(executable))
119124
context.executable = executable
120125
context.python_dir = dirname

0 commit comments

Comments
 (0)