FAQs: Python Setup on macOS 11.3

  1. Preferred way of installing Python?
    Homebrew, $brew install python.
    Alternatively, MacPython.

  2. What Python executables am I using now?

    • $which python
    • $which python3
  3. How to default to Homebrew-installed Python?
    Add export PATH="/usr/local/opt/python/libexec/bin:$PATH" to ~/.bashrc or ~/.zshrc.

  4. How to uninstall MacPython properly?
    Follow the instructions on this page. Simply put, remove the Python folder in the Application folder, files in /Library/Frameworks/Python.framework, and Python symlinks in /usr/local/bin/.

    MacPython automatically adds PATH instructions to ~/.zprofile. Remove those if you see unwanted results with $echo $PATH (e.g., /Library/Frameworks/Python.framework/Versions/3.9/bin).

  5. Do I get Tkinter with Homebrew-installed Python?
    Yes. Try $brew install python-tk.

  6. Do I need to port python/pip to python3/pip3 in my shell profiles?
    Not necessary if you have the right setup with Homebrew.

  7. How do I build Python files in Sublime Text?
    Change "shell_cmd": "python -u \"$file\"" to "shell_cmd": "python3 -u \"$file\"" in Python.sublime-build.