The first step to becoming a Python coder is to install or update Python on your computer. Python can be installed in a variety of ways, including through the official Python.org distribution, a software package manager, the IoT (Internet of Things) and scientific computing, just to name a few.
In this article, we'll be using official Python distributions, which are often the best option for beginners.
Installing the most recent versions of Python and the packages you'll need to experiment with is a good place to start when learning Python. To create an environment, you need a certain Python version, as well as the necessary packages. Consequently, separate environments are required if you wish to create or utilize apps that have varied Python or package version needs.
Python's virtual environment is a valuable tool for managing dependencies and separating projects. It's possible to install Python site packages (third-party libraries) in a specific project directory rather than the entire system Python.
On Windows, there are three installation options:
You'll learn how to check the current release of Python installed on your Windows machine in this section. You'll also discover which of the three installation options is best for you.
Step 1: Install Python based on your choice of version.
Python 2 and Python 3 are available, each with its syntax and way of doing things.
Here we are going to download python 3 for this course.
Step 2: Download an executable installation file for Python.
Open on your browser and head to the python.org website. On this page click on downloads. Here you can find the latest version of python. Choose the version you require and click Download. For this example, we go with Python 3.10.2.
When you select download, a list of available executable installers with varied operating system requirements will appear. Select the installer that best suits your system's operating system and download it. Let's say we go with the Windows installer (64 bits).
Step 3: Run the Installer Script
If the Python 3.10.2 Windows 64-bit installation was downloaded, run the installation program by double clicking it. Make sure both checkboxes at the bottom are selected before clicking Install New.
Now installation process begins when you click the Install Now button. Wait for a few minutes for installation process to finish.
you should see the screen below if the installation is complete. Now you have python installed in your computer.
Step 4: On Windows, check to see if Python is installed.
To see if Python has been installed successfully on your system. Observe the instructions.
When installing python in Linux distros, there are two ways involved:
You'll find out how to know if your Linux computer has a current version of Python in this section and which of the two installation techniques should you choose?
Many Linux versions include Python, but it is unlikely to be the most recent update, and it may even be Python 2 rather than Python 3. Try the following command in a terminal window:
$ python –version
If you have Python installed on your computer, this command should return a version number.
If your current Python version isn't the most recent Python 3 version available, you'll want to upgrade.
Step 1: Installing Python requires first downloading and installing the necessary development packages
A new version of Debian has been released; therefore, we need to update our old version to the new one.
Open the terminal in your Linux machine. Then run “apt update” in your Linux terminal to update the system before you begin installing python. Then, run "apt-get upgrade" in your terminal to upgrade the system.
then, run " apt install build-essential zlib1g-dev \libncurses5-dev libgdbm-dev libnss3-dev \libssl-dev libreadline-dev libffi-dev curl" to install the build essentials.
Step 2: Download the most recent version
Navigate to your browser in python.org and click on downloads. You will see the latest version of python with a download button, but this is the windows version, instead, navigate to the Linux/UNIX link below it to download the Linux version.
Download the most recent version of Python3 from the official Python website.
You will receive an archive file ("tarball") containing Python's source code when the download is complete.
Step 3: Unzip the tarball folder to a convenient location.
A tar.gz file is a collection of compressed files that may be downloaded in order to conserve space and bandwidth. The tarball, another name for the.tar file, is a container for other files that may be carried about on a flash drive. Because of the extension, gzip is the most extensively used compression application in use. These files can be unzipped in the same way as a standard zipped file:
Run “tar –xvzf a.tar.gz” in the terminal to unzip.
Step 4: The downloaded script must be configured.
Type cd Python-3.*. /configure in your terminal once you've unzipped the Python package and press enter.
Step 5: Begin the build procedure
Use this command below if you need to install an updated version alongside the old version in case you don`t want to delete the old one:
$ sudo make install
Step 6: Verify that the installation is working properly.
Open your terminal and type command below and click enter.
python --version
Python3 has been successfully installed once the output says Python 3.x.
Congratulations! For your system, now you have access to the most recent update of Python. Your Python adventure is just getting started.