Hey everyone,
To get ready for today’s class, we all need to have the latest version of Python installed. Follow these steps carefully to ensure you’re all set. We’ll first check if you already have Python installed, and then branch out based on what we find.
Note: Whenever we say "terminal" or "your terminal" in these instructions, we’re referring to iTerm2.
- Make sure you have your terminal (iTerm2) open. If not, launch it now.
-
In your terminal, type the following command and press Enter:
python3 --version
-
If you see a version number like
Python 3.x.x
, it means you have Python installed. Proceed to the Update Existing Python section. -
If you see a message saying
command not found
or something similar, it means Python is not installed. Proceed to the Install Python section.
Please follow the instructions based on whether you already have Python installed or not. Do not run both branches; just stick to the one that applies to your situation.
If you already have Python installed:
-
Update Homebrew: Make sure Homebrew is up to date by running:
brew update
-
Upgrade Python: To upgrade your existing Python installation to the latest version, run:
brew upgrade python
-
Verify the Update: After the upgrade, check the version again to ensure it's the latest:
python3 --version
You should see something like
Python 3.x.x
, wherex.x
is the latest version number. -
Optional - Brave Souls Only:
Notice: This step is optional. If you want to set an alias so thatpython
points topython3
, you can do so with the following command. If this seems complicated, feel free to skip it! We’ll go over it in class.echo 'alias python=python3' >> ~/.zshrc source ~/.zshrc
-
You're All Set!
- You’re now ready for class. Take note of your Python version and share it with me.
- Also, visit Python’s download page to check the latest version available and compare it with yours.
If you don’t have Python installed:
-
Install Python:
- After Homebrew is installed, run:
brew install python
- After Homebrew is installed, run:
-
Verify the Installation: Once the installation is done, check the Python version:
python3 --version
You should see something like
Python 3.x.x
, confirming that you have the latest version. -
Optional - Brave Souls Only:
Notice: This step is optional. If you want to set an alias so thatpython
points topython3
, you can do so with the following command. If you’re not sure about this, it’s okay to skip it for now. We’ll cover it in class.echo 'alias python=python3' >> ~/.zshrc source ~/.zshrc
-
You're All Set!
- You’re now ready for class. Take note of your Python version and share it with me.
- Also, visit Python’s download page to check the latest version available and compare it with yours.
Looking forward to seeing everyone ready with the latest Python version!