Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I tell bash to use /usr/local/bin/python3 instead of /usr/bin/python3?

I perl script that runs the following command:

/bin/bash -c 'TASKRC=/Users/me/.taskrc /usr/local/bin/task add \'the task\''

The script works fine when the perl script is run from the command line. The command executes some python code in a library, tasklib, to insert a task into a TaskWarrior database.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

However, when the perl script is executed indirectly by an app, Karabiner Elements, I get errors.

Some debug statements reveal this when the perl script is run standalone:

Python version: 3.9.9
Python bin: /usr/local/bin/python3

However, when Karabiner executes the perl script, I see:

Python version: 3.8.9
Python bin: /usr/bin/python3

So an older 3.8 version of tasklib is getting used. I need to somehow to tell bash to use the 3.9.9 version of python so it can find the newer tasklib library found in /usr/local/lib/python3.9/site-packages. How do I do this?

>Solution :

Perhaps

/bin/bash -c 'PATH=/usr/local/bin:$PATH; TASKRC=/Users/me/.taskrc task add "the task"'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading