How to Check the Default Python Installation Path on Mac Terminal

To check the default installation path of Python on a Mac terminal, enter 'which' followed by the version number. For example: 'which python3.10'. This will display the default path as '/usr/local/bin/python3.10'. To view all current Python versions and their paths, you can use commands like:

  • which python2.7 -> /usr/local/bin/python2.7
  • which python3.5 -> /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
  • which python3.7 -> /usr/local/bin/python3.7
  • which python -> /usr/local/bin/python
  • which python3 -> /Library/Frameworks/Python.framework/Versions/3.5/bin/python3
  • which python2 -> /usr/local/bin/python2. (Note that older versions may be present.) To check your current Python version, use:
  • python --version This might return something like 'Python 3.5.1'. You can also see where Python is installed with:
  • echo $PATH This command shows all directories in your PATH variable. For pip versions, you can run:
  • pip2 --version or
  • pip3 --version. The system's built-in Python path is typically located at '/System/Library/Frameworks/Python.framework/Versions', which may contain multiple versions of Python under 'Current'. Navigate to 'Current/bin' and run './python --version' to see the system's active version (note: using 'python --version' checks the user's currently set version). If you've installed Python via Homebrew, it will be found at '/usr/local/Cellar/python', specifically under its respective version folder (e.g., 2.7.x). Ensure correct installations for user-specific commands.

Leave a Reply

Your email address will not be published. Required fields are marked *