0

If I launch python --version from Terminal on macOS, I'm getting 3.9 version. The same is for python3.

But if I launch these from my C++ program (I use QProcess), I'm getting 2.7 for python and 3.7 for python3.

Why so?

Is there any way to launch the same python version as terminal launches?

Is there a way to find path to the latest python installed on the machine (I need to support macOS and Linux).

Addition #1. On another macOS machine, there is Python 3.10 installed in /Applications folder. python3 --version shows expected 3.10 version, but my C++ program does not even see this python3, so macOS displays its system error message which suggests the user to install additional components (which does not work through). enter image description here

3
  • why don't you use Python virtual environment? Commented Oct 25, 2021 at 14:38
  • @Devstorm21 What is it and how to use it from my C++ program? Commented Oct 25, 2021 at 14:40
  • It might be helpful for you. stackoverflow.com/questions/14685798/… Commented Oct 25, 2021 at 14:43

1 Answer 1

0

This is an issue with macOS. An app launched from the Dock has a different PATH environment variable than the shell has. Here is a question about how to fix this: Get bash $PATH from C++ program

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.