How to install Python and pip on Windows
It has been some time since I last used Python. So I wanted to make sure I have the newest version, but instead of upgrading, I decided to go with a fresh install. So in this post, I will show you how to install Python and pip and explain all the options.
Tip: if you want to quickly install Python and pip without knowing what all the options mean, just follow the red squares on the print screens.
1. Check if Python is already installed
Before starting installing Python, we first make sure you do not already own Python. Press the windows key and type cmd
and press enter to open the terminal in the terminal type py
. If Python is not installed you will get the following message.
2. Download the Python installer
Now let's go to the Python website: Python installer
Click the Download Python button, in this case, we are downloading 3.9.6
which was at this moment their latest release. I advise you to always take the latest version, especially when starting a new project.
After clicking the button, the installer will be downloaded. Go to the installer and click show in folder.
This will navigate you towards your download folder, double click the installer.
If you did not manage to click on the show folder, then navigate towards your download folder manually: windows key type file explorer
and click downloads.
3. Install Python and pip
The installer will open, make sure to check Add Python 3.9 to Path
, this will allow you to just type python
in the terminal instead of defining the whole path. Click on Customize installation.
On the next screen we have some options:
- Documentation: I rather use the Python documentation from their website, but this option might be useful if you are working offline a lot.
- pip: This is the package manager for Python, you are going to need this a lot.
- tcl/tk and IDLE Tkinter is Python's standard interface and GUI kit, IDLE is a text editor you can use for Python. But I recommend you to use either Visual Studio Code or PyCharm.
- Python test suite: Python testunit, I recommended you to download this as well, writing tests is very important.
- py launcher: Is a shortcut to all of the installed versions of Python on one's system. for all users: Make it available to all users.
Choose your options and click Next.
On to the next screen, we have the Advanced options.
- Install for all users: If you choose this option Python will be accessible globally if not, you have to go to the chosen user path to access Python.
- Associate files with Python: Just yes, make
.py
files associate with Python. - Create shortcuts for installed applications: You will mostly use Python from the terminal, but if you want you can keep it checked.
- Add Python to environment variables: This will allow you to just type
python
in the terminal instead of defining the whole path. We already checked this option on the first screen. - Precompile standard library: This is somewhat more difficult, I found a good explanation here: Precompile standard library
- Download debugging symbols: These are for debugging in Visual Studio, these can always be installed later, so I will keep it unchecked, also since I am not using Visual Studio.
- Download debug binaries: These are also for debugging in Visual Studio, the same applies here.
If you want you can change the install location
, but I am happy with the chosen path by the installer. After you made sure you have chosen the right options, click install.
You might get a pop-up window from windows where they ask if the installer is allowed to make changes, simply choose yes.
After that, the installation will start, and after a moment you will end on the following screen.
4. Check if python and pip are correctly installed
To make sure they are correctly installed.
windows key type cmd
and then press enter type pip -V
and press enter you will now see the version of pip. To check the version of Python just type python
.
5. Conclusion
We have successfully installed Python and pip on Windows, ensuring that we have the latest version for a fresh start. By following the step-by-step instructions and understanding the options available during the installation process, we can now conveniently use Python and its package manager, pip. With this foundation, we can explore further topics such as setting up a Python virtual environment. Feel free to refer to my other post for more information on that topic. Happy coding!
