Adapted from Dezerae Cox's Learning to Code resources.
🎯 Goal
This guide provides general-purpose instructions for setting up a Python coding environment in Visual Studio Code (VS Code).
💡 Note: You do not need extensive prior experience with Python environments or Git. The goal is to introduce these tools early so that environment management and version control become a natural part of your coding workflow.
Before getting started, download the appropriate version of each program for your operating system:
- Miniconda — Python and Conda environment management
- Visual Studio Code — your code editor
- GitHub Desktop — optional graphical interface for Git and GitHub
- Git — version control
While the installers are downloading, make sure you have created a GitHub account.
💡 Tip: If you have an institutional email address, consider using it when creating your GitHub account. Many institutions provide access to GitHub's educational or organizational benefits.
If you expect to change institutions soon, you may prefer to use a personal email address as your primary account email.
Install VS Code using the downloaded installer.
Windows users: During installation, you may be given options to add VS Code to the context menu or allow it to open files from the Desktop. Enable these options.
Install Git using the default options wherever possible, with one exception.
For example:
- Let Git decide the default branch name
- Use Git from the command line and third-party software
- Use the bundled OpenSSH
- Use the default credential helper
- Continue with the other recommended defaults
When prompted to select the default editor, choose:
Visual Studio Code
This allows Git to open VS Code whenever it needs you to edit a commit message or other Git-related text.
Install GitHub Desktop and log in using the GitHub account you created above.
💡 Note: GitHub Desktop is optional. Git can be used entirely from the command line, but GitHub Desktop provides a convenient graphical interface for common Git operations.
Install Miniconda using the default options.
If the installer asks whether to add Conda to your PATH, the recommended approach is generally to leave the default option unchanged and use the Anaconda/Miniconda Prompt to access Conda.
Open Anaconda Prompt from the Start menu.
If (base) is not written at the start of the line, run conda activate base
If Windows does not recognize the conda command, you may need to add your Miniconda installation to your system PATH.
A common error looks like:
'conda' is not recognized as an internal or external command
See the Conda documentation or this troubleshooting guide, also outlined below, if you encounter this problem.
-
Find conda location
Check where conda is installed:
where conda
-
Open Advanced System Settings
Search Windows for Advanced System Settings and open it.
-
Edit Environment Variables
Click Environment Variables.
Under the appropriate user or system variables, select
Pathand click Edit.
Add the Miniconda directories.
add miniconda3, miniconda3\Scripts, and miniconda3\Library\bin paths. If your file structure is similar to mine (look at output from step 2 to determine
condapath) then the paths should like like the paths below (replaceuXXXXXXwith your username and adjust the path if Miniconda was installed elsewhere)C:\Users\uXXXXXX\AppData\Local\miniconda3 C:\Users\uXXXXXX\AppData\Local\miniconda3\Scripts C:\Users\uXXXXXX\AppData\Local\miniconda3\Library\bin -
Test Conda
Open Command Prompt -- not Anaconda Prompt -- and test the installation:
conda activate baseIf Conda activates successfully, you should see
(base)at the beginning of the command promptIf not, type
conda install anaconda-navigatorthen pressyThen run
conda activate baseas per this_help_link in case you get a warning. -
Restart computer 😊
This guide focuses on getting VS Code configured to run Python code.
For more detailed information about Git-based version control, check out the Additional Resources section below.
-
Launch VS Code, at which point you will be greeted with the “Welcome” screen. Take a few minutes to get familiar with the editor using the “Get Started with VS Code” and “Learn the Fundamentals” sections.
-
Install extensions
Open the Extensions panel and search for the Python extension.
You may also want to install other useful extensions. Here are a few to get you started:
Extension What it does Atom One Dark Theme A dark theme with clear syntax highlighting Material Icon Theme Adds useful file and folder icons Jupyter Provides Jupyter notebook and interactive Python support Sourcery Provides AI-assisted Python refactoring Atom Keymap Provides a familiar set of popular keyboard shortcuts GitLens Adds enhanced Git and repository functionality GitHub Markdown Preview Makes VS Code's Markdown preview more closely match GitHub autoDocstring Generates Python docstrings Excel Viewer Allows Excel and CSV files to be previewed in VS Code
Now that the extensions are installed, let's configure a few useful VS Code settings.
Open the Command Palette with:
Ctrl + Shift + P
Then search for:
Preferences: Open Settings (UI)
💡Note: you could also arrive there using the traditional menu bar using
File→Preferences→Settings
-
Set the default Python interpreter to your Miniconda installation
For example
C:\Users\uXXXXXX\AppData\Local\miniconda3\envs\base\python.exe
-
Set Send to Interactive Window to ON
-
Set Notebook Root Directory to
${workspaceRoot}
-
Windows OS only: set default shell to Command Prompt
-
Hide the annoying Minimap
-
Turn on bracket autocompletion (life changing)
-
Turn on wordwrap
When working in VS Code, it is good practice to organize your projects into repositories.
A repository, or repo, is a collection of files associated with a project. Repositories can range from large research or data projects to something as simple as a folder containing a few Python scripts.
For this tutorial, we'll create a small test repository called:
print hello
Place it somewhere logical and easy to find.
For example, you might organize your projects like this:
Desktop/
└── repos/
├── print_hello/
├── project_1/
└── project_2/
The exact location is up to you — the important thing is to develop a consistent organizational system.
Open VS Code. If another repository opens by default, create a new window with the keys:
Ctrl + Shift + N
Then open the print_hello folder as your workspace. You can drag and drop a folder from file explorer.
💡 Tip: In VS Code, a workspace generally corresponds to the project or repository you are currently working in.
Now let's create our first Python file.
In the Explorer panel, create a new file and give it the .py extension:
Opening the file should cause VS Code to prompt you to select a Python interpreter.
If everything is configured correctly, VS Code should automatically find your Conda installation.
Select
base
If VS Code cannot find it automatically, select:
Enter interpreter path
and navigate to your Miniconda installation
Once selected, your active Python interpreter should appear in the lower-right corner of the VS Code window.
Open a new terminal using:
Ctrl + Shift + `
You can also use:
Terminal → New Terminal
If everything is working correctly, Conda should automatically activate and you should see:
(base)
at the beginning of your terminal prompt.
💡Tip: The
(base)annotation indicates that the Condabaseenvironment is currently active.
One of the major benefits of using Conda is that you can create separate environments for different projects.
This prevents packages and dependencies from one project from interfering with another.
Create a new environment with:
conda create --name myenv python=3
Replace myenv with the name you want to give your environment.
You can also specify your exact python version, for example:
conda create --name myenv python=3.11
💡Tip: Giving environments descriptive names can make it much easier to remember what they are used for.
conda activate myenv
The terminal prompt should now show:
(myenv)
Install the packages you'll need for your project.
For example:
conda install seaborn pandas numpy scipy jupyter ipykernel
For this workflow, every new environment should contain:
jupyter
ipykernel
These packages allow VS Code's Python extension to communicate with the environment and run code through the Interactive Window.
💡 Think of the Conda environment as your project's toolbox. Each environment contains its own Python installation and the packages that project needs.
During installation, Conda will calculate the packages and dependencies required.
It may display a long list of packages, even if you only requested a few. This is normal — Conda is resolving the dependencies needed to make everything work together.
When prompted:
Proceed ([y]/n)?
enter:
y
After creating the environment, reload VS Code.
Open the Command Palette:
Ctrl + Shift + P
and select:
Developer: Reload Window
After VS Code reloads, select the Python interpreter shown in the lower-right corner.
Choose the new Conda environment you just created.
You are now ready to run Python using your project-specific environment! 🎉
Let's make sure everything works.
Open the Python script we created earlier and add some simple code:
message = "Hello, world!"
print(message)
Select the lines of code and press:
Shift + Enter
VS Code should open an Interactive Window and connect to the Python kernel associated with your selected Conda environment.
The selected code should then execute and display its output:
A green check mark next to the executed code indicates that it ran successfully.
Congratulations — you now have a working Python development environment in VS Code! 🎉
-
🐍 You can learn more about using the Python Interactive Window here:
Working with Jupyter code cells in the Python Interactive window
-
🐍 Additional conda commands are available via a cheat sheet:
-
🐍 Detailed instructions for managing python environments using conda are also available here:
-
🐙 For more general info on using Git and GitHub for version control:
-
🐙 And specifically for using Git and version control with VS Code:
-
✂️ To unlock a lot of the productivity in VS Code, snippets are indispensable. Check out the basics here:
At this point you should have:
✅ VS Code installed
✅ Git installed
✅ A GitHub account
✅ Miniconda installed
✅ The Python and Jupyter VS Code extensions
✅ A working Conda environment
✅ A project repository
✅ Python running through the VS Code Interactive Window
From here, the next step is to start building projects — and, importantly, using Git to keep track of your work as you go.







