Friday, 17 October 2025

Getting started with Anaconda and Python on Windows



Last time, I posted a tutorial on how to run Python for beginners (https://zulk-unimap.blogspot.com/2025/10/python-for-beginners-tutorial.html). Today, I found another good tutorial on how to run Python using Anaconda, as shown in the video above. The summary of the video is as follows:

1- Install Visual Studio Code (https://code.visualstudio.com/). You can use any code writer, such as Notepad++.

2- Install Anaconda (https://www.anaconda.com/)

3- Install git-scm (https://git-scm.com/). This software is similar to CDM for Windows, and its interface is more like Linux. So, it is recommended to use this software to replace CDM or the terminal in Visual Code.

During Git installation, select "Use Visual Studio Code as Git's default editor".

4- Run Git Bash.

Bash
$ conda init bash

Then, close and reopen Git Bash

Bash
$ conda create --name demo    #to create a new environment or path entitled "demo"

$ conda activate demo    #to activate the "demo" environment. Like, if we want to analyse
                                        #specifically, please have your own environment.

$ conda deactivate    #to deactivate the "demo" environment. back to the "base" environment.

$ conda install python     #install python to the "demo" environment

$ conda list     #to display all packages in the "demo" environment. 
                        #this is the way to look at the packages.

$ which python    #to show the directory of the Python install.

$ python --version    #to show the version of Python.

5- Open Visual Studio Code. Dont close Git Bash.

Create a file named demo.py on the desktop. Open demo.py using Visual Studio Code and write down this code:

python
Print ("Hello World")

Save as demo.py. No need to execute .py in Visual Studio Code.

6- Open Git Bash (How to execute demo.py)

Bash
$ cd ~/Desktop    #change directory to the Desktop, since we want to run demo.py 
                            #that located at the Desktop

$ ls    #keyword for listing all files in the directory, which is in the Desktop. 

$ python demo.py    #how to run demo.py.

7- How to install package(s)?? Run Git Bash, and we want to install it in the Demo environment.

What if our script "demo.py" has a package??
Bash

$ conda install requests    #how to install "requests", which is a package.

python demo.py    #how to run demo.py. That has the "requests" package

No comments:

Post a Comment