gh-96861: Check for unset sys.executable during venv creation. (GH-96887)

This commit is contained in:
Vinay Sajip 2022-09-17 14:58:31 +03:00 committed by GitHub
parent 0b62964b04
commit 2cd70ffb3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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