How to set up Python on Visual Studio Code

Kenny Yip Coding
19 May 202106:56

Summary

TLDRThis video tutorial guides viewers on setting up Python with Visual Studio Code, an alternative to PyCharm and Anaconda. It starts with checking the Python version and installing it from python.org if not available. The presenter then demonstrates installing Visual Studio Code from code.visualstudio.com and creating Python files. The video shows how to run Python scripts using the terminal and Visual Studio Code's built-in terminal. It also covers installing the Python extension and Code Runner for easier execution, and configuring settings for terminal output. Finally, it discusses organizing Python files in a folder and opening them in Visual Studio Code.

Takeaways

  • đŸ’» The video provides a tutorial on setting up Python with Visual Studio Code, an alternative to PyCharm or Anaconda.
  • 🔍 To check the installed Python version, use 'python --version' or 'pi --version' in the terminal or command prompt.
  • đŸš« If Python is not recognized, it indicates that Python is not installed on the machine.
  • 🌐 The tutorial guides to download Python from python.org and install it on the system.
  • đŸ–„ïž Visual Studio Code is recommended for its ease of use and convenience when working with multiple programming languages.
  • 🔗 The video instructs viewers to download Visual Studio Code from code.visualstudio.com.
  • 📁 It's important to include the '.py' or '.pi' extension when saving Python files to ensure proper recognition.
  • 📝 The video demonstrates how to write simple Python scripts and run them using the command line.
  • đŸ› ïž To enhance the coding experience, the tutorial suggests installing the Python extension and Code Runner extension in Visual Studio Code.
  • ⚙ The settings are adjusted to ensure that running Python scripts through Visual Studio Code outputs to the terminal.
  • 📂 The video concludes with organizing Python files into a folder and using the terminal to open the folder in Visual Studio Code.

Q & A

  • What is the preferred text editor for Python programming according to the video?

    -The video suggests that Visual Studio Code is the preferred text editor for Python programming over PyCharm or Anaconda.

  • How can you check the installed Python version on your system?

    -You can check the installed Python version by typing 'python --version' or 'pi --version' in the terminal or command prompt.

  • What does the message 'python is not recognized as an internal or external command' indicate?

    -This message indicates that Python is not installed on your machine or it is not added to the system's PATH variable.

  • What is the recommended website to download Python from the video?

    -The video recommends downloading Python from python.org by going to the 'downloads' section.

  • How can you install Visual Studio Code according to the video?

    -You can install Visual Studio Code by visiting code.visualstudio.com and downloading the appropriate version for your operating system.

  • What is the significance of the '.py' or '.pi' extension when creating a Python file in Visual Studio Code?

    -The '.py' or '.pi' extension is significant as it identifies the file as a Python script, which is necessary for the file to be recognized and executed as Python code.

  • How can you run a Python script from the terminal in the video?

    -You can run a Python script from the terminal by navigating to the script's directory and typing 'python script_name.py' or 'pi script_name.pi'.

  • What is the advantage of using the 'Run Code' button in Visual Studio Code as shown in the video?

    -The 'Run Code' button in Visual Studio Code allows you to execute the Python script without manually typing the command in the terminal, simplifying the process.

  • Why is it necessary to install the 'Python' extension and 'Code Runner' extension in Visual Studio Code?

    -The 'Python' extension provides support for Python in Visual Studio Code, while the 'Code Runner' extension allows you to run code directly from the editor.

  • How can you configure Visual Studio Code to run Python scripts in the terminal instead of the built-in console?

    -You can configure Visual Studio Code to run Python scripts in the terminal by going to settings, editing the 'actions on save' section in 'settings.json', and setting 'code runner.run in terminal' to true.

  • What is the suggested method to organize Python files in the video?

    -The video suggests creating a folder for Python files, such as 'python files', and then dragging the files into Visual Studio Code for organization.

Outlines

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Mindmap

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Keywords

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Highlights

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant

Transcripts

plate

Cette section est réservée aux utilisateurs payants. Améliorez votre compte pour accéder à cette section.

Améliorer maintenant
Rate This
★
★
★
★
★

5.0 / 5 (0 votes)

Étiquettes Connexes
Python SetupVisual Studio CodeCoding TutorialPython 3.8Development ToolsCode EditorProgramming GuideIDE SetupPython CodingVSCode Extensions
Besoin d'un résumé en anglais ?