Setup Python Environment on Mac
1. Download and Install Python 3.12
1. Download Python 3.12:
○ Go to the Python Downloads page.
○ Click on the macOS installer for Python 3.12 to download the .pkg file.
2. Install Python 3.12:
○ Open the downloaded .pkg file and follow the installation prompts.
2. Download and Install Visual Studio Code (VS Code)
1. Download VS Code:
○ Go to the VS Code Downloads page.
○ Download the macOS version of VS Code.
2. Install VS Code:
○ Open the downloaded .zip file and drag the VS Code app to your Applications
folder.
3. Check and Update Path
1. Check the Path:
Open Terminal and check where Python is installed:
bash
Copy code
which python3.12
○
2. Update the Path in .zshrc:
Open .zshrc in a text editor:
bash
Copy code
nano ~/.zshrc
Add the following line to include Python in your PATH:
bash
Copy code
export
PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
○
○ Save and exit (CTRL + O, Enter, CTRL + X).
3. Create Symlink for Python:
Create a symbolic link for python to point to python3.12:
bash
sudo ln -s
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
/usr/local/bin/python
○
4. Reload .zshrc:
Apply changes:
bash
Copy code
source ~/.zshrc
4. Verify Installation
Check Python Version:
bash
Copy code
python --version
python3 --version
1.
2. Check VS Code:
○ Open VS Code from Applications or using Spotlight (Cmd + Space, then type
"Visual Studio Code").
Setup Python Environment on Windows
1. Download and Install Python
1. Download Python:
○ Go to the Python Downloads page.
○ Click on the Windows installer for Python 3.12 to download the .exe file.
2. Install Python:
○ Run the downloaded .exe file.
○ Important: Check the box that says "Add Python to PATH" before clicking "Install
Now."
○ Follow the installation prompts to complete the installation.
2. Download and Install Visual Studio Code (VS Code)
1. Download VS Code:
○ Go to the VS Code Downloads page.
○ Download the Windows version of VS Code.
2. Install VS Code:
○ Run the downloaded .exe file and follow the installation prompts.
3. Verify and Update Path
1. Check Python Path:
Open Command Prompt or PowerShell and run:
cmd
Copy code
where python
where python3
○
2. Update Path (if needed):
○ If Python is not found, you might need to add it to your system PATH manually:
■ Right-click on This PC or Computer on the Desktop or in File Explorer.
■ Select Properties > Advanced system settings.
■ Click Environment Variables.
■ In the System variables section, find and select the Path variable,
then click Edit.
■ Add the path to the Python installation directory (e.g.,
C:\Users\<YourUsername>\AppData\Local\Programs\Python\
Python312\).
■ Click OK to save the changes.
4. Verify Installation
1. Check Python Version:
Open Command Prompt or PowerShell and run:
cmd
Copy code
python --version
python3 --version
○
2. Check VS Code:
○ Open VS Code from the Start Menu or by searching for it.