Installation of python#

Step 1: Install VS Code#

VS Code is an advanced text editor for python files. We will use it to both edit python source files and run the python programs.

  • Install VS Code for your platform:

Need help?

If you run into issues following the instruction guide, you can get help from the Python support.

Python support

pythonsupport.dtu.dk

Step 2: Install Python#

To run Python files, you must have a Python interpreter installed. The interpreter is responsible for actually running your programs.

  • First check if you already got a suitable version installed. From the VS Code terminal, type the exact phrase: python --version. If you have Python installed, this will print out the version number. If it is Python 3.8 or greater: Go ahead! skip to step 3.

  • Go to https://www.python.org/downloads/windows/

  • Click on the link starting with Python 3.11.

  • Scroll to the bottom of the page and choose Windows installer (64-bit).

  • Install the downloaded file by following the instructions.

  • Important: Make sure to check the option Add python 3.11 to PATH during the installation.

Step 3: Install the Python extension for VS Code#

To enable Python support in VS Code, you must install the Python extension. To do this:

  • From the activity bar, click on the icon with the four boxes indicated in the screenshot.

  • This will open a pane. Type python in the search field and hit enter

  • Install the Python extension (top most search hit). It will have Microsoft as publisher.

Step 4: Get the course software and exercises#

To get started, you must first download the course folder to your computer:

You can download the folder as a zip-file:

Once downloaded, extract the zip-archive.

Rename the folder from 02002students-master to 02002students

You should end up with a folder called: 02002students containing the source code.

You can move the folder to a new location, but once you complete the next step, you may not move or rename the folder for the remainder of the course!. It is important that you remember the location of this folder.

Step 5: Install the course toolbox and software packages#

  • You need to know the absolute path of the folder for the next step. You can find the absolute location by right-clicking on the folder and selecting Properties (Windows) or Get Info (Mac). The path will be listed under Location (Windows) or Where (Mac).

  • Open a terminal. If you are not sure how to open a terminal, see the bullet points below:

    • On windows, press the -key, type cmd, and press Enter to open the first result.

    • On Mac, press the ⌘-key + Spacebar, type terminal, and press Enter to open the first result.

  • Navigate to the folder you created in the last step, i.e. 02002students.

    • You can display the current path of the terminal by typing cd (Windows) or pwd on (Mac/Linux).

    • You change to a subfolder by typing cd name_of_the_folder, or move one folder up by typing cd ...

  • Check that you have navigated to the correct folder, by verifying that it contains requirements.txt.

    -You can list which files are in the folder by typing dir (Windows) or ls (Mac/Linux).

  • Run the following command in the terminal:

python -m pip install -r requirements.txt

The command will print a lot of output about the installation process, but assuming the final line looks similar to

Successfully installed bidict-0.22.1 coverage-7.3.0 cp-2023.0 diskcache-5.6.1 dtumathtools-1.1.0 flask-socketio-5.3.5 importnb-2023.1.7 matplotlib-3.6.3 mergedeep-1.3.4 pyfiglet-0.8.post1 python-engineio-4.6.1 python-socketio-5.8.0 sympy-plot-backends-2.4.3 unitgrade-1.0.0.0

you are good to go.