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

(cherry picked from commit 2cd70ffb3f)
This commit is contained in:
Miss Islington (bot) 2022-09-18 13:58:46 -07:00 committed by GitHub
parent 1448e2a42b
commit 9b789e5828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,6 +128,11 @@ def create_if_needed(d):
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