Skip to content

Commit 9ae917f

Browse files
authored
Merge pull request #235 from minrk/python-sys-executable
kernelspec: interpret 'python' as sys.executable
2 parents 2bf3530 + 8467a0c commit 9ae917f

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)