Prerequisites
In this article, we will talk more about how to install python on windows. If you're new to python. You can check our beginner guide to python to know more about its usage. In this article, we will talk about:
- Downloading Python
- How to install it
- Install Python in windows OS
- How to uninstall python
First, let's get started with
Downloading Python
It depends on which operating system you're using. Downloading Python is an easy process. This is one of Python's main goal. To be easy to run, easy to install. You can download python from different resources. The official Python website is the go-to to download python. It has the download links for all operating systems. It has detailed release notes for differences between versions. You need to take a look at the release notes if you're upgrading your python version. It'll help you know the changes exactly.
To download python you need to
- Go to the download page on the official website.
- Select your operating system. (Windows, Mac, Unix)
- Click on the exact version you want to download. (latest version is recommended)
Your download will start automatically. Now It's time to install Python.
Installing Python on windows
After downloading Python. Now we will install it. In this article, we gonna focus on installing python on windows. There are two ways of installing python on windows. The first one if you have Bash ubuntu installed. Bash ubuntu is an ubuntu terminal in the windows operating system. It allows you to run ubuntu commands in windows. It's very helpful if you need a bash shell to work with. Keep in mind it's not fully ubuntu terminal. It has some windows restrictions.
To install Python in bash ubuntu. You need first to have to download the ubuntu terminal. You can download it from the Windows store. After downloading it you will need to open the terminal. It might take some time, in the beginning, to download and install terminal necessary packages. After it finished you will find the normal ubuntu terminal. That you can run all the commands you want in it.
- Install dependencies.
$ sudo apt install software-properties-common $ sudo add-apt-repository ppa:deadsnakes/ppa
- Update the OS package manager
sudo apt update
- Install the latest version
$ sudo apt install python3.8
To check python is installed. You should type the below command.
python --version
output:
Python 3.8.2
Now you have installed python successfully. Note that you installed Python in this shell. This means it's not installed globally on the system. which means if you have a python script and tried to run this script outside the terminal. You need to run it from the shell.It'll not run. Let's explain why.
Your python is installed only on the Ubuntu subsystem. Ubuntu terminal is a container running in windows. It helps to translate your commands into binary system calls to Windows. By installing python. You install it on the subsystem only.
Install Python in windows OS
If you want to install python Globally on windows. You should follow these steps. After downloading Python. In your downloads, you'll have a .exe file. Open it will open this screen.
You can choose to install it now. It will add the python path in your system partition. You can customize the installation path and user access.
After Finishing the installation. You will have the setup success screen. It'll have links to documentation and getting start guide. After close this screen you will find a python shortcut on your desktop or windows menu. Now you can run any python script.
How to uninstall python
As you can see installing Python is easy. What about remove it. To remove Python from your device You have two options if you're using Windows. The simplest way is:
- Go-to control panel
- Search for python
- Right-click and choose uninstall
This will remove python entirely from your system.
If you installed python through the ubuntu subsystem. It means that it's not globally installed. Now You should open a new terminal window. Run the below command.
$ sudo apt remove python3.8
This will uninstall python from the subsystem. The dependencies package will be installed. This command will not delete the data files of python are still exist on your system. If you want remove it completely from your system. You should run:
$ sudo apt autoremove python3.8
This will remove python dependencies too from your system.
conclusion
Installing or uninstalling python is an easy process. Python was designed to be that from the beginning. You can install it in windows with a simple GUI. Or you can install it using the Ubuntu subsystem. Removing python as easy as installing it. You can uninstall it via the GUI or the terminal.