From 568b25166dbfc52095bf7d460361241f5eea4ebb Mon Sep 17 00:00:00 2001 From: Zach White Date: Sun, 29 Aug 2021 14:53:38 -0700 Subject: [PATCH] ensure that the directory for sys.executable is in the user's path --- lib/python/qmk/cli/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index b22f1c0d2d9..f45e33240c6 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -181,8 +181,14 @@ if int(milc_version[0]) < 2 and int(milc_version[1]) < 4: print(f'Your MILC library is too old! Please upgrade: python3 -m pip install -U -r {str(requirements)}') exit(127) +# Make sure we can run binaries in the same directory as our Python interpreter +python_dir = os.path.dirname(sys.executable) + +if python_dir not in os.environ['PATH'].split(':'): + os.environ['PATH'] = ":".join((python_dir, os.environ['PATH'])) + # Check to make sure we have all our dependencies -msg_install = 'Please run `python3 -m pip install -r %s` to install required python dependencies.' +msg_install = f'Please run `{sys.executable} -m pip install -r %s` to install required python dependencies.' args = sys.argv[1:] while args and args[0][0] == '-': del args[0]