Hello World, an Introduction with Python
Hello fellow Steemians,
Back in my university days, I often notice that lectures and tutorials that revolve around software don't really emphasizes on installation stage but rather focuses on how to use them. I can understand this because the computer labs are fully equipped with the required software in them but a quick lecture on this will be truly appreciated and a definite time saver to those who aren't that IT savvy and want to use the software using their own laptops.
One might argue that installation will just consist of several mouse clicks and that's all. For paid apps/software, that is expected but for open source programs like Python & OpenFOAM, they are often not that straightforward. Before we start with our first line of code in Python, let us begin with the proper installation of Python and several of its packages, specifically Numpy (for scientific computing) & Matplotlib ( for plotting capabilities).
Python Installation
Where to begin with...
1) Go to https://www.python.org/
2) Click the "Downloads" menu
3) Next, you have to decide the Python release version that you want. Typically, one would opt for the latest one. Since Python 3.6.2 seems to be the latest one, I've selected that.
4) Once you choose your Python release version, you will be greeted with another page where you will have to choose the installation file accordingly. Make sure you have selected the correct Python version according to your operating system (microsoft or mac) and bit (32-bit or 64-bit). For ease of installation, choose the executable installer, not the web-based installer.
5) Once the installer is downloaded, run and install it as normally you would do for any typical software. This process will only take several minutes to complete.
6) To check whether you have successfully install Python, you can try find/search on Windows programs. You should be able to find the program as below:
As of now, you have successfully installed Python safely in your computer.
Numpy & Matplotlib Installation
1) First of all, you need to go to the location of your Python installation folder. For my case, it's as below:
2) Go to the "Script" folder. From here, you have to create a new file, which is a Windows Batch File. Easiest way to do this is by creating a new text file inside this folder. Then, open the file and write cmd inside the text file. Next, rename & save the file by "save as" it as local.bat. (Note: ensure that save as type is chosen as all files when doing the save as)
3) We are almost there. Now, run the local.bat file. You will be greeted with a command prompt. You just have to write these simple commands to install Numpy and Matplotlib individually:
i)pip install numpy
ii)pip install matplotlib
For illustration purposes, refer images below:
As of now, you can regarded that you have successfully installed Python alongside with Numpy & Matplotlib packages. You can now close/exit the command prompt.
Running Python
Now comes the moment of truth. Let's try print a statement by using Python. First, find/search IDLE in your system and run it. A new window will pop up which is your Python interpreter. The syntax for Python is quite straightforward in most cases. To print a statement, you just have to type print, followed by parentheses which have single/double quotes and words inside it. For today's example, lets write our first Python command which is:
>>>print ("Hello World, Hello Steemit Community")
I hope this post will really benefit to those in need of help in installing Python and its packages.
Do let me know if there is any comment or query.
Have a nice weekend everybody. ;p
Congratulations @rahim.rahman! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
You published your First Post
You got a First Vote
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP