CS-WIKI101
Loading...
Searching...
No Matches
wvscode

Python w/ Visual Studio Code

NOTE Tested on macOS Sonoma 14.0

These instructions are specifically tailored for students in CS111, DS223 and other courses that use Python. The steps in this guide will help you install Python, Visual Studio Code and the Python extension for Visual Studio Code on macOS.

Table of Contents

Step 1: Install Python

NOTE If you already have Python installed, you can skip these steps.

Follow the instructions provided in the README to install Python on macOS.

Step 2. Download and Install Visual Studio Code

Visual Studio Code is a lightweight yet powerful source code editor. Follow the steps below to download and install Visual Studio Code on macOS:

  1. Go to the Visual Studio Code website at https://code.visualstudio.com.
  2. Click on the Download for macOS</kdb>



    Visual Studio Code Website

  3. After the download is complete, open Finder and navigate to the Downloads folder.
  4. Locate the VSCode.app file in the Downloads folder.



    Visual Studio Code in Downloads Folder

  5. Drag and drop the VSCode.app file from the Downloads folder to the Applications folder. This will install Visual Studio Code on your macOS.

Once the installation is complete, you can launch Visual Studio Code from your Applications folder and start using it for your programming tasks.

Back to Top

Step 3. Add the code command to the PATH

Adding the code command to the PATH allows you to open Visual Studio Code from the Terminal. Follow the steps below to add the code command to your PATH on macOS:

  1. Open Visual Studio Code.
  2. Open the Command Palette by pressing Shift + Command + P
  3. Type shell command and select the option "Shell Command: Install 'code' command in PATH".

    Install 'code' command in PATH
  4. Enter your system password if prompted. This step is necessary for granting the required permissions.

After completing these steps, you can now open Visual Studio Code from the Terminal by typing code and pressing Enter. This allows for easier access and quick code editing directly from the command line.

Step 4. Install the Python Extension for Visual Studio Code

To enhance your Python development experience in Visual Studio Code, you can install the Python extension.

  • Open Visual Studio Code.
  • Go to the Extensions view by clicking on the square icon on the left sidebar or pressing Ctrl + Shift + X
  • Search for Python in the Extensions Marketplace.
  • Look for the Python extension by Microsoft and click the Install button next to it.

Additional Step: Opening Terminal from a Directory

If you want to open the terminal directly from a specific directory, you can follow these steps:

  • Open the Finder application.
  • Navigate to the desired directory.
    Course Directory
  • Right-click on the directory and select Services from the context menu.
  • Choose New Terminal at Folder to open the terminal at that directory.

    New Terminal at Folder
  • Ready to work!

    Terminal in Working Directory

References

Source Description
Visual Studio Code Documentation Official documentation for Visual Studio Code
Python Extension for Visual Studio Code Python extension for Visual Studio Code
Command line How to add Visual Studio Code to the PATH

Need assistance? Check out my discussion board or review the GitHub status page.

© 2023 AppleBoiy • Code of Conduct • [MIT License](LICENSE)

Back to Top