Skip to content

Commit 8467a0c

Browse files
committed
kernelspecs launched with 'python' use sys.executable
avoids PATH issues when parent is in an env, but has been launched without activating the env.
1 parent 41eca1c commit 8467a0c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

jupyter_client/manager.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ def format_kernel_cmd(self, extra_arguments=None):
174174
else:
175175
cmd = self.kernel_spec.argv + extra_arguments
176176

177+
if cmd and cmd[0] == 'python':
178+
# executable is 'python', use sys.executable.
179+
# These will typically be the same,
180+
# but if the current process is in an env
181+
# and has been launched by abspath without
182+
# activating the env, python on PATH may not be sys.executable,
183+
# but it should be.
184+
cmd[0] = sys.executable
185+
177186
ns = dict(connection_file=self.connection_file,
178187
prefix=sys.prefix,
179188
)

0 commit comments

Comments
 (0)