I have an application which had optional extras depending on if the user has the software installed.
On Linux what is the best way to determine if something like python and PyUsb is installed?
I am developing a C++ Qt application if that helps.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is inefficient (requires forking and exec’ing /bin/sh). There has to be a better way! But as a generic approach… There’s always system().
(Remember to use WEXITSTATUS()! Watch out for making programs uninterruptable!)
There is also popen(), which can be useful for grabbing output from programs to verify version numbers, libraries, or whatnot.
If you need bidirectional (read&write) access to a subprocess, best to use pipe(), fork(), exec(), close(), & dup2().