Visual Studio Code (VS Code) is a powerful and lightweight code editor that is perfect for Python development. Follow this guide to set up your environment.
- Install Python (ensure it's added to your PATH).
- Install Visual Studio Code.
- Open VS Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar or pressing
Ctrl+Shift+X
. - Search for "Python" and install the extension by Microsoft.
- Open a Python file or create a new one with a
.py
extension. - Press
Ctrl+Shift+P
to open the Command Palette. - Type
Python: Select Interpreter
and select the appropriate Python interpreter from the list.
- Pylance: For better IntelliSense and type checking.
- Python Docstring Generator: To generate docstrings for your functions.
- Code Runner: To quickly run Python scripts.
- Open the terminal in VS Code (`Ctrl+``).
- Run the following commands:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Select the virtual environment as your Python interpreter.
- Open the Debug view by clicking on the Debug icon in the Activity Bar or pressing
Ctrl+Shift+D
. - Click on "create a launch.json file" and select "Python".
- Customize the configuration as needed.
Use the terminal to install packages:
pip install <package_name>
- Open the settings (
Ctrl+,
). - Search for Python-specific settings like
python.linting.enabled
orpython.formatting.provider
and configure them.
You are now ready to start developing Python projects in VS Code. In this tutorial, we will be following along Coursera's Google IT Automation With Python.
Google IT Automation With Python
We will be making our code open-source, and all of it will be available on Github.
If you would like to support this software-engineer, buy me a coffee! <3 :)
buy_me_a_coffee = "0xb26DDe29cF72F37A64aF8B292209B6FEe686A3B6"
print(buy_me_a_coffee)
# Output: Buy me a coffee: 0xb26DDe29cF72F37A64aF8B292209B6FEe686A3B6
- VS Code Python Documentation
- Python Official Documentation
- Github Official Documentation
- Git Official Documentation