How to setup Python 3.9.2 Default

I will be appreciated to share your knowledge.

  1. How can I setup python 3.9.2 as my default on OS Mojave?
  2. I have installed some app through terminal and it doesn't shows in Application or finder application folder that I can delete it, how can I clean up that from my computer (OS Mojave)?
  3. how to clean Junk files and app from MacBook Pro installed OS Mojave?

Posted on Feb 26, 2021 1:30 PM

Reply
1 reply

Feb 26, 2021 2:33 PM in response to jwafa

From Python.org, and Python 3.9.2, download the macOS 64-bit intel Installer. This should land in your Downloads folder and is a proper macOS installer. It will install Python 3.9.2 into /Library/Frameworks/Python.frameworks, and create links from its binaries (python3, idle3, pip3, etc.) into /usr/local/bin. It also installs a Python 3.9 folder in your /Applications folder and modifies your PATH statement in your ~/.bash_profile file.


Your initial PATH statement needs to access /usr/local/bin before other PATH locations:


export PATH=".:$HOME/bin:/usr/local/bin:$PATH"


and the Python 3.9.2 installation updates this to the following in your Bash ~/.bash_profile:


PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"


Your Python scripts should either contain the first line to run Python3 code:


#!/usr/bin/env python3


which would allow you to run them from the Terminal after making them executable, and with or without that first line preamble, you can also run them via:


python3 ./script.py


Remember that the python 2.7.16 that is pre-installed on Mojave can only be run by using the command python, not python3.


Cannot help you delete anything installed from the Termina until you share what it was, and what command you used to install it.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to setup Python 3.9.2 Default

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.