In this page you'll learn how to set your computer up with Python and with Visual Studio Code (a code editing application) so you can write and run Python.
We kindly ask everyone to follow these steps before joining the first lesson on Tuesday, November 25 at 16:30 (over Zoom – link to come soon).
With that being said, please don't stress if you encounter issues during the setup process. Shoot us an email at py.ldv@xcit.tum.de at any time and we'll be happy to help you out. We will actually be checking this email address frequently over the next few days so that we can give you support in time for the first lesson. If you still have trouble even after contacting us, please do know that we will also take a moment at the beginning of the first lesson to help anyone experiencing trouble with the installation.
1. Installing Python
In this step, you'll install Python to your computer. More specifically, you're installing the runtime environment for Python. This is essentially a bundle of everything you need to run Python on your computer, including the Python Interpreter, the Python Standard Libraries, and the PIP package installer. We'll teach you more about these in the lessons, but for now, all you need to worry about is the installation, which is pretty straightforward!
We will be using Python version 3.13.9 throughout this course. While there typically are not code-breaking differences between versions of Python, it makes life a lot easier if everyone is running the same version. It means we have a standard, controlled environment, which makes it easier for us (the tutors) to troubleshoot any problems and to provide support for everyone. Therefore, even if you already have Python installed on your computer, we would recommend switching to Python 3.13.9 specifically. We'll show you how to do this below.
1.1. Checking if Python is already installed
It is possible that Python is already installed on your computer. You can easily find this out by running a simple command on your computer's command prompt.
1.1.1. Windows
Follow these steps:
- Click the Start menu (Windows icon) on the taskbar, or press the Windows key on your keyboard.
- Type "cmd".
- Select "Command Prompt" from the list.
- In the Command Prompt window that opens, type the following command and hit the enter key to run it:
python3 --version
If you get an error message, your computer does not have Python installed. Proceed to the next section of this tutorial to install it.
If a new line appears and your Python version is 3.13.9, you can skip forward to section 2: Setting up Visual Studio Code.
If a new line appears and your Python version is not 3.13.9, please proceed to the next section to install version 3.13.9.
When installing Python on Windows. Please make sure to check the option „add Python.exe to PATH“ during the installation. If this step is missed it is possible that the „Python3“ command is not recognized in the terminal. If this happened to you don‘t worry. The easiest way to fix this is to uninstall Python and reinstall it with the option checked. If you are comfortable with editing the windows registry you can also check out online guides. Look for: „add Python to Path Windows“.
1.1.2. macOS
Follow these steps:
- Open Spotlight Search by pressing Command + Space bar or by clicking the magnifying glass icon in the menu bar.
- Type "Terminal".
- Select "Terminal" from the list.
- In the Terminal window that appears, type the following command and hit the enter key to run it:
python3 --version
If you get an error message, your computer does not have Python installed. Proceed to the next section of this tutorial to install it.
If a new line appears and your Python version is 3.13.9, you can skip forward to section 2: Setting up Visual Studio Code.
If a new line appears and your Python version is not 3.13.9, please proceed to the next section to install version 3.13.9.
1.1.3. Linux
Please run the command python3 --version in a terminal emulator of your choice.
If you get an error message, your computer does not have Python installed. Proceed to the next section of this tutorial to install it.
If a new line appears and your Python version is 3.13.9, you can skip forward to section 2: Setting up Visual Studio Code.
If a new line appears and your Python version is not 3.13.9, please proceed to the next section to install version 3.13.9.
1.2. Installing Python 3.13.9
1.2.1. Windows and macOS
Please visit the following webpage for Python 3.13.
https://www.python.org/downloads/release/python-3139/
Scroll down until you see the button to download the installer for your specific operating system. Click to download the installer.
Once your internet browser finishes downloading the installer, open it and follow the steps in the installer. You do not need to check/uncheck any specific checkboxes in the installer; the default settings will suffice.
Once the installer confirms that Python has been installed, we recommend going back to the previous section (section 1.1: Checkinf if Python is already installed) to see if you were successful. If so, move on to step 2: Setting up VSCode.
1.2.2. Linux
The exact installation process will depend on the distribution of Linux that you are using, but in general, you should install the Python package directly through your package manager using a terminal command. Make sure to specify version 3.13.9 (or, if that does not work, specify version 3.13).
Debian/Ubuntu-based distributions:
sudo apt install python3.13
Fedora-based distributions:
sudo dnf isntall python3.13
Once your package manager finishes the installation, we recommend going back to the previous section (section 1.1: Checking if Python is already installed) to see if you were successful. If so, move on to step 2: Setting up VSCode.
2. Setting up Visual Studio Code (VSCode)
If you've reached this step, hopefully you successfully installed Python. That's what you'll need to execute code written in the Python programming language. But what about writing Python code? There are many options out there, but we highly recommend Visual Studio Code as a beginner-friendly and feature-rich IDE, or Integrated Development Environment.
An IDE is basically a program that provides you with many tools for writing, running, debugging, and uploading your code. We will be using Visual Studio Code, which has been around for a quite a while now and has therefore amassed quite a large user base. This means it's very easy to find videos, blog articles, and forum posts to help you with just about any question you might have using VSCode. This IDE also has a very large marketplace of extensions which allow you to enhance its capabilities in a number of ways (in fact, you will be installing a few extensions later in this tutorial).
2.1. Install VSCode
2.1.1. Windows and macOS
Start by visiting the link below and download the correct file for your operating system.
https://code.visualstudio.com/download
Once your web browser finishes downloading the installer, go ahead and run it. As with the Python installation, click through the installer.
You can check that the program successfully installed by searching for it in the Start menu (Windows) or in Spotlight Search (macOS).
2.1.2. Linux
Visit the link below and download the right package file for your distribution of Linux.
https://code.visualstudio.com/download
Download the .deb package for Debian/Ubuntu-based systems and install it using the following command (make sure your file is in the current working directory):
sudo apt install ./<filename>.deb
Or, for Fedora-based systems, instead download the .rpm package and install it like so:
sudo dnf install ./<filename>.rpm
Your desktop environment will recognize VSCode as a launchable application one it's successfully installed. Search for and open VSCode to check if your install was successful.
2.2. Install extensions
This part is pretty straightforward. There are three extensions you will need to install within VSCode.
Within VSCode, on the left panel, click the extensions icon, which looks like the image below:
In the Extension Marketplace, search for each of the following three extensions and click the install button for each one:
- Python extension – Provides debugging, and environment management support for Python inside VSCode. This environment management support will be actually important in the next step (2.3 Set up a Python virtual environment).
- Jupyter Extension – Enables native support for Jupyter Notebooks, which are files containing code cells that can be run independently. They are a great learning tool, so we will use them for our live demonstrations and take-home assignments.
- Pylint Extension – A code analysis tool which checks for errors and organizational errors in your code. This is excellent for anlyone learning a new programming language.
2.3. (Windows only) Changing the command prompt
Skip to part 3 (Setting up a Python virtual environment) if you are not using Windows.
In Visual Studio Code, you can conveniently open a command prompt right in your IDE to run commands on your computer. By default, the Windows version of Visual Studio Code uses a Windows PowerShell prompt, which has certain restrictions in place that prevent running the script we need to use for virtual environments. Therefore, we instead need to use use the older Windows command prompt (cmd) instead of PowerShell. No worries if you don't know what those are – this step is easy.
Open up Visual Studio Code, press Ctrl+Shift+P to open the command palette. In the text field that appears, search for and select the the option "Terminal: Select Default Profile". Choose cmd. Make sure the Windows PowerShell option is not selected.
3. Setting up a Python Environment
We're almost done. The next step is to install some Python packages. If you aren't familiar with the concept of libraries in programming languages, they are essentially pre-built functions that you can use in your code so that you do not have to program every component of your project from scratch. We'll want to install these packages within a virtual environment, however. Without getting into too much (at this point unnecessary) detail, you'll need Visual Studio Code to know which packages to access when running your code, and having a virtual environment will help with that.
3.1. Make a Folder for this Course
You will want a central location for the code files you will be working on during this course.
-
Create a new folder somewhere on your computer (e.g., on your Desktop or in your Documents folder) and name it something descriptive, like "PythonCourse".
-
Open Visual Studio Code.
-
At the top of the window (Windows/Linux) or of the screen (macOS) in the menu bar, click "File" then to then "Open Folder..." (or "Open..." on macOS).
-
Navigate to and select the folder you just created.
You should now see the name of your folder in the VSCode file explorer (panel on the left side of the VSCode window). Any files or subfolders you create will appear in a tree-like view in that file explorer.
3.2. Create a Virtual Environment
Now we will create the isolated virtual environment where our course packages will be installed.
Within Visual Studio Code, open the integrated Terminal. You can do this by clicking "Terminal" in the top menu bar and clicking "New Terminal". Alternatively, use Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS) to open the command palette and search for "Terminal: Create New Terminal"
Once the terminal is open, run the following command to create the environment:
python3 -m venv .venv
After running the command, you should see a new folder named ".venv" appear in your VSCode file explorer (panel on the left side) under your main "PythonCourse" (or whatever you named it) folder. If this is not the case, please make sure you opened your folder in VSCode before opening the terminal.
VSCode might ask you if you want to select this new environment as your interpreter. If it does, click Yes or Select! If it doesn't, don't worry. We're going to do that anyway during the first lesson.
3.3. Install Needed Packages
3.3.1. Windows
With the Terminal panel still open in VSCode, run the following command:
.venv\Scripts\activate
If you were successful, "(.venv)" should show up on the next line before the prompt. If not, double-check that you followed the directions in step 2.3: Changing the command prompt.
Install all the needed packages with the following command (type 'y' for 'yes' if you're asked to approve the installation):
pip3 install scikit-learn matplotlib seaborn numpy pandas ipykernel
3.3.2. macOS and Linux
With the Terminal panel still open in VSCode, run the following command:
source .venv/bin/activate
If you were successful, "(.venv)" should show up on the next line before the prompt.
Install all the needed packages with the following command (type 'y' for 'yes' if you're asked to approve the installation):
pip3 install scikit-learn matplotlib seaborn numpy pandas ipykernel
4. Get help if you need it!
That's it! At this point, you should be ready for your first lesson, which will take place Tuesday, November 25 at 16:30 over Zoom. We will be sending out the Zoom link soon if you haven't already received it at the time of reading this.
If you had any issues, don't hesitate to send an email to py.ldv@xcit.tum.de and we'll get back to you. We will be actively paying attention to this email address, so you can expect a timely reply. We trust that you'll do the best you can to get all of this set up and that you'll reach out to us in advance if you need extra help – that will make it easier for us to jump right into things on Tuesday. Still, don't stress if you have issues with the whole process. We will help you out during the first lesson, too.