Friday, January 25, 2019

Python - Installation on Linux and Windows 10

A. Installing on Linux
a. To install python on Linux, you have to use software installation tool such as yum for redhat
# yum search python
# yum install python

By default, python is install on most operating systems. You may already have version 2.x installed.

After the installation, you must set PATH for version 3.


A. Installing Python3 in Windows

1. Download python3 from the web

As of now, the latest version is - Python 3.7.2 - 2018-12-24
https://www.python.org/downloads/windows/
I downloaded,
https://www.python.org/ftp/python/3.7.2/python-3.7.2-amd64.exe

2. Installation process
a. Create a directory Python3 under the C drive.
b. Double click the python installer and choose customize.
c. Chose installation directory as C:\Python3 and click on Install
d. Accept the default options and continue until inish.

B. Setting up the Environment Variable (Windows 10)

a. Right Click on My Computer or This PC
b. Click on Properties; and then click on on Advanced System Settingsor
c. Click on Advanced and then on Environment Variables at the bottom.
d. On your Environment Variable windows, look under system variables.
e. Search the variable Path and once found, double click to edit
f. Click on New and type c:\Python3 and click ok.
g. Once you click ok, you will see something like this.
C:\Program Files (x86)\iCLS Client\;......;C:\Python3

C. Writing your python code
a. Create a directory under Documents [ C:\Users\devi\Documents\Python-Practice ]
b. Right Click on the directory and click on Text Document
c. Rename the file as hellp.py
d. Open the file and type
    print("Hello, World !!!")
e. Save the file.
f. Press Windows Button and R at the same time, a pop up windows shows up
g. Type cmd and click OK.
h. You will see dos windows. Go to your code location
   cd C:\Users\Devi Neopane\Documents\Python-Practice
h. Now at the prompt, type, python hellp.py

You should see the output.

If you don't get the correct output, you have to review your PATH.

No comments:

Post a Comment