ensure that the directory for sys.executable is in the user's path (#14229)

master
Zach White 2021-08-29 16:46:36 -07:00 committed by GitHub
parent b705020daf
commit baa423004a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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)}') print(f'Your MILC library is too old! Please upgrade: python3 -m pip install -U -r {str(requirements)}')
exit(127) 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 # 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:] args = sys.argv[1:]
while args and args[0][0] == '-': while args and args[0][0] == '-':
del args[0] del args[0]