What is Python?
Python is a general-purpose high-level programming language. Among other purposes, it can be used for back-end development, web development, software development, data science, and writing system scripts (automation).
Benefits of Python
Many data scientists choose Python because of its easy-to-learn dynamic typing nature and because of numerous open-source Python libraries available, such as NumPy, pandas, scikit-learn, SciPy, Matplotlib, Plotly, Flask, Django, and FastAPI. A number of free resources for Python programming are available online, including tutorials and videos.
Now that we’ve covered the introduction and benefits, let’s get started.
Methods of installing Python in the Windows Environment
The purpose of this article is to show you the different ways Python can be installed on a computer.
Python installation from the Python Official Website
Follow this link to an official Python download page. At the time of writing, the most recent stable release of Python is 3.10.1. Here you find Python in both 32-bit and 64-bit versions.
After downloading the installation file, double-click on it to bring up the installer screen.
Click on the Customize installation
. The following screen will appear:
Choose the options circled in red
, if not selected.
pip
, which stands for “preferred installer program”, is the Python installation manager used to install PyPI packages, including their dependencies.
tcl\tk and IDLE
option installs:
tcl\tk
a package used for GUI development, andIDLE
is a built-in development environment for Python that comes with implementing the default language.
Check the Add Python 3.10 to PATH
option encircled with red
. It will place the requested directories into the system environment variables needed to access python from the command line.
Please click on Install Now
to complete the Python installation process. To ensure Python is installed properly. Enter cmd
in Run command (Window + R) to open a command prompt
.
If Python is successfully installed on your PATH, you will receive the following prompt when you input Python at the command prompt.
Microsoft Windows [Version 10.0.19041.1348]
(c) Microsoft Corporation. All rights reserved.
C:\Users\HP>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
To find out where Python is installed, type where python in the command prompt
.
C:\Users\HP>where python
C:\Users\HP\AppData\Local\Programs\Python\Python310\python.exe
C:\Users\HP\AppData\Local\Microsoft\WindowsApps\python.exe
The above will install the minimal Python with standard libraries. A library/package, on the other hand, may be added to enhance the capability of Python. To install a new library/package, type the following into the command prompt
:
pip install <package name>
To upgrade an existing installed library/package, enter the following command:
pip install --upgrade <package name>
To remove an installed library/package, type the following into the command prompt
:
pip uninstall <package name>
To list all the installed packages, use the following command:
pip list
Anaconda distribution for Python installation
Anaconda is a distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment.
Use this URL to obtain the Anaconda installation package. Double-click the downloaded package to install it.
For Anaconda distribution installation, simply use the default parameters.
After the installation is complete, click Start
button, type anaconda
, and then click on the Anaconda Prompt (anaconda3)
.
You will see the following Anaconda prompt if the installation is successful:
(base) C:\Users\HP>
Python installation with Miniconda
Miniconda is a stripped down version of Anaconda Package, which installs only Python with conda
dependancies.
This link will take you to a page where you may download Miniconda.
Double-click to install it.
The installation interface is identical to that of the Anaconda package
. For the installation, use the default options. Click Start
button and type miniconda after it is installed. You will get the following command prompt
after clicking miniconda prompt (anaconda3)
.
(base) C:\Users\HP>
For installing, upgrading, and removing library/packages, both
Anaconda
andMiniconda
utilize the identical set of commands.
To install new library/package, use the following command:
conda install <package name>
To update the Miniconda/Anaconda or library, use the following command:
conda update anaconda or <package name>
To uninstall a library/package, use can type the following command:
conda uninstall <package name>
To list all the installed packages, use the following command:
conda list
Python installation with WinPython
The easiest way to run Python, Spyder with SciPy and friends out of the box on any Windows PC, without installing anything!
WinPython is a free open-source portable distribution of the Python programming language for Windows 8/10 and scientific and educational usage.
WinPython can be downloaded and installed from these links i.e. Sourceforge or Github.
There are two kinds of packages available. One is the minimal Python package, as indicated by the dot before exe. The second is the full-fledged scientific Python packages that do not have a dot in its name, as seen in the image below.
It comes in a 7-Zip compressed package. Its installation is simple. Just double-click the 7-Zip package and navigate to the location where you wish to unpack. Wait for the decompression to complete and you’re done.
WinPython is something different from other Python Distributions:
- non-invasive: WinPython lives entirely in its own directory, without any OS installation.
- customizable: add your missing packages, zip the WinPython directory and give it to your students.
How to register WinPython on PATH.
When you have Administrative rights
Navigate to the installed directory and double-click WinPython Control Panel
.
Simply select Register distribution
from the Advanced
page. This will add an entry to your PATH
environment variables.
Registering your WinPython installation will:
- associate file extensions .py, .pyc and .pyo to Python interpreter
- register Python icons in Windows explorer
- add context menu entries Edit with IDLE and Edit with Spyder for .py files
- register WinPython as a standard Python distribution (standard Python Windows installers will see WinPython in Windows registry)
That is exactly what the official Python installer would do to your machine: in other words, you can have it both ways!
When you do not have Administrative rights
You can still add Python to your PATH
environment variables if you don’t have administrator rights.
To do so, click Start button and type environment. Then, under Edit the system environment variables
, select Environment Variables and add the following two paths in your PATH
. Please make sure to shift C:\Users\HP\AppData\Local\Microsoft\WindowsApps
(Microsoft Store) below two directories otherwise if you try to access Python from the command prompt
, Windows will open the Microsoft Store for the Python installation.
C:\WPy64-3950\python-3.9.5.amd64
C:\WPy64-3950\python-3.9.5.amd64\Scripts
Which installation method is recommended?
If you are new to the Python, I recommend using the Anaconda Package or WinPython package. Both packages provide practically all the libraries needed for the data science work. When working in a limited environment where installation is not permitted, WinPython emerges as the obvious winner.
If you’re an expert and know what you’re doing, you may use Python from the Official website, Miniconda or WinPython dot to install only the libraries you need.
Personally, I’ve tried all of the methods, but I recommend WinPython as your go-to data science software package.
- due of its portability,
- simplicity of use, and
- You can install multiple versions of Python without any conflict.
This concludes the article. If you liked this post, please share it with your friends and coworkers!