Setup Python Coding Workspace with VS Code

Setting up a coding workspace with Python and VS Code is straightforward. In this guide, we will install Python, install VS Code, configure a Python environment, and run our first Python program in a Jupyter notebook.

Install Python

  • Download the latest Python installer from the official Python website.
  • In the installer window click Add python.exe to PATH ⚠️
  • Complete the installation.

Install VS Code

  • Download VS Code from https://code.visualstudio.com/
  • in the installer window, enable “Open with Code” in the Windows Explorer context menu.. It will help you open folders in VS Code easily.
  • Complete the installation.

Integrate VS Code and Python

Now that both Python and VS Code are installed, let us create our coding workspace. The first time, there will be a few installations to complete, so be patient and read the prompts carefully before cancelling.

  • Create a folder named codes/python in Explorer. Right-click on the folder > Open with Code.
  • VS Code asks whether you trust the authors of the files in the folder; select Trust.
  • Create a new file named test.ipynb.
  • Click + Code on top and type
        print("Hello World!")
    
  • Run the cell by clicking ▷. Click the prompt Install/Enable suggested extensions Python + Jupyter and wait for the installation to complete.
  • Upon completion, there will be a prompt to select Python Environments…. Click and select the Python you just installed.
  • click run ▷ again and in the prompt install ipykernel.
  • Finally, you will see the output of the cell
     Hello World!
    

Installing Packages with Pip

Now install some packages in Python.

  • In the VS Code window press Ctrl + ` to open the integrated terminal.
  • Check Python version by the python -V command. It should match the Python version you just installed.
  • for installing packages scipy and pymoosh give command
        pip install scipy pymoosh
    
  • After installing, you can see the packages with the pip list command.

Try the Notebook

import this
import antigravity

You now have a working Python + VS Code + Jupyter environment and are ready to start coding!

Further Reading




Enjoy Reading This Article?

Here are some more articles you might like to read next: