Installing and setting up Python¶
Warning
If you run into problems using the command line, you might want to take a look at troubleshooting on the command line.
Having trouble with uv?
This page uses uv to install Python. If uv is causing problems, try the pyenv version of these instructions instead.
Prerequisites¶
Open the command line¶
First, you'll want to open up the command line.
Click the magnifying glass to open up Spotlight, then search for Terminal. Run it.
Open Windows Terminal, which we set up to use Git Bash. Make sure it says UCRT64 (or MINGW64) somewhere, not PS C:\!
Previously installed Pythons¶
You can run the following command exactly as it is written below to list all of the Pythons your command line can see.
If it says something like
python not found, congratulations! You have zero Pythons installed!
The first one in the list is the one that's used when python is typed.
This is just for reference: copy and paste the results somewhere. If we run into problems later, it might help us figure out what's going on.
If you see anaconda or miniconda anywhere in there, take a look at removing Anaconda before you continue.
Otherwise, you're good to go!
Use the Start Menu to open up Add or Remove Programs. Scroll down to find anything starting with Python or Anaconda.
If you find any, uninstall them now. I've especially had issues with old Python versions fighting new Python versions on Windows.
If
which -a pythonmentionsWindowsApps, don't worry! That's a fake Python that Windows uses to send you to the Microsoft Store. Our new Python will take its place.
Package manager¶
One way to install software on your computer is to download software. Another way is to run commands on the command line, which uses a tool called a package manager.
Since we think the command line is cool, we're going to use that technique.
We'll be installing Homebrew from https://brew.sh/. They have a long line of text on their homepage that you cut and paste into Terminal, but to make your life easy I've reproduced it here:
It might ask for your password by saying something like Password: []. Type your computer password and press enter.
If you type and type and nothing shows up... I promise, just type your password and hit enter! The command line is hiding your typing from anyone who might be looking at your screen.
When it's done, Homebrew might tell you to run a couple more commands under Next steps. If it does, copy and paste them in, too!
Good news: Windows comes with a package manager called winget, so there's nothing to install!
Confirm it worked
To confirm Homebrew was installed, type the following command to check the documentation for the brew command.
Did it work? Great, you're good to go.
Installing uv¶
Now we'll install uv, which is the tool we'll use to install and manage Python.
It might ask you to agree to some terms. Type Y and hit enter. When it says Successfully installed, you're done.

Don't leave off the
--source wingetpart! Without it, winget also searches the Microsoft Store. On computers with an older version of winget – brand-new laptops that haven't updated yet, or school and work laptops where the Store is locked down – that fails with an error about a "server certificate."
Close your command line and open up a new one.
Confirm it worked
To confirm uv was installed correctly, run the following command to ask for its version number.
If it prints anything other than "command not found" you're good to go.
Installing Python¶
There are all kinds of different Python versions out there. We're going to use Python 3.13, which is new enough to be current but old enough that most data analysis packages should work well with it.
uv protects the Python it installs, so we'll make a shared "environment" named data where we'll have our own special Python. This is where all of the packages you install will live. We'll also tell your command line to turn it on automatically whenever you open a new window.
Creating your Python environment¶
Copy and paste these commands into your command line. Be sure to hit enter after the last one!
uv venv ~/.venvs/data --python 3.13 --seed
touch ~/.zshrc
grep -qxF 'source "$HOME/.venvs/data/bin/activate"' ~/.zshrc || echo 'source "$HOME/.venvs/data/bin/activate"' >> ~/.zshrc
source ~/.zshrc
The first line makes the environment, the next two add a line to ~/.zshrc – the file that runs every time you open Terminal – to turn the environment on, and the last one runs that file right now.
uv venv ~/.venvs/data --python 3.13 --seed
[ -f ~/.bash_profile ] || echo '[ -f ~/.bashrc ] && . ~/.bashrc' > ~/.bash_profile
grep -qxF 'source "$HOME/.venvs/data/Scripts/activate"' ~/.bashrc 2>/dev/null || echo 'source "$HOME/.venvs/data/Scripts/activate"' >> ~/.bashrc
grep -qxF 'export PYTHONUTF8=1' ~/.bashrc || echo 'export PYTHONUTF8=1' >> ~/.bashrc
source ~/.bashrc
The first line makes the environment. The next few add lines to ~/.bashrc – the file that runs every time you open Git Bash – to turn the environment on and to make Python use UTF-8 when reading and writing files. The last one runs that file right now.
When you paste, nothing happens until you press Enter. Then it'll download Python and set everything up. (It'll suggest a command that starts with Activate with: – you can ignore that, we've already taken care of it.)

You should see (data) at the beginning of your command line. That means you're using your new special Python environment. On Windows, (data) shows up on its own line, right above the student@computer line.
If the first line says
A virtual environment already exists, that's fine! You've probably done this before. The rest of the lines will still do their job.
Confirm it worked
Close your command line and open up a new one. You should see (data) at the beginning of it automatically.
Now run each of these commands:
which pythonshould mention.venvs/data. This is the most important one!python --versionshould print Python 3.13.something. Note that the command ispython, space, hyphen, hyphen,version(it gets mistyped a lot!).pip --versionshould also mention.venvsanddata.
If which python says something else – Anaconda, WindowsApps, .pyenv, /usr/bin – then some other Python is getting in the way. Take a look at removing Anaconda, or bring the output of which -a python to class.
On Windows, it should look something like this:

Installing packages¶
If you come across some code on the internet that asks you to "install a package" using pip install XXXX, you're now good to go. For example, if you want to install pandas, you just use the following code:
Confirm it worked
Run this command to ask Python which pandas it found:
It should print a path with .venvs and data in it.

Feeling fancy? You can also use
uv pip install pandas. It does the exact same thing, just a lot faster.
What if something breaks?¶
Sometimes after installing a lot of things your environment gets into a weird state: something that used to work now has an error, or a package refuses to install.
The great thing about our setup is that you can always just delete the environment and start over. Run this command to replace your old environment with a fresh one:
Then close your command line, open a new one, and reinstall whatever packages you need (and Jupyter!).
You're all set!¶
Congrats!
Next up: install Jupyter.