Friday, May 11, 2018

Python chap 1 (Hi friends this is the continuation of previous post so i kindly request you to read that before this post. As this blog is also prepared for beginners so i advice you that you don't need to by-heart this lessons just read and understand it if you have any doubt ask in the comment section )

First we need to know the basic characters of a python language they are
And now we need to start to install python in our machine first
type python in the command line which can be selected from the start button by typing cmd it will give us the info that if python is installed and which version is installed if it is not installed
you can install it from python official site for that click here you will get the full most up-to-date and current source code, binaries, documentation, news, etc., is available on the official website of Python https://www.python.org/
you can start to install python from that site and if you have any doubt on that please inform me on the comment section
Python distribution is available for a wide variety of platforms. You need to download only the binary code applicable for your platform and install Python. If the binary code for your platform is not available, you need a C compiler to compile the source code manually. Compiling the source code offers more flexibility in terms of choice of features that you require in your installation. Here is a quick overview of installing Python on windows platform −

                              Installing on Windows

To install on windows you need to go to this python download link https://www.python.org/downloads/ and from there download from the windows version some points to remember are
  •  If installing Python 3.6 as a non-privileged user, you may need to escalate to administrator privileges to install an update to your C runtime libraries.
  •  There are now "web-based" installers for Windows platforms; the installer will download the needed software components at installation time.
Then after downloading the file run it Just accept the default settings, wait until the install is finished, and you are done.

                                    Setting up PATH

Programs and other executable files can be in many directories, so operating systems provide a search path that lists the directories that the OS searches for executables.

                    The path is stored in an environment variable, which is a named string maintained by the operating system. This variable contains information available to the command shell and other programs.
               The path variable is named as PATH in Unix or Path in Windows (Unix is case sensitive; Windows is not).In Mac OS, the installer handles the path details. To invoke the Python interpreter from any particular directory, you must add the Python directory to your path.


                         Setting path at Windows

To add the Python directory to the path for a particular session in Windows −At the command prompt − type path %path%;C:\Python and press Enter. 
Note − C:\Python is the path of the Python directory

                                   THE PYTHON ENVIRONMENT VARIABLES ARE
It has a role similar to PATH. This variable tells the Python interpreter where to locate the module files imported into a program. It should include the Python source library directory and the directories containing Python source code. PYTHONPATH is sometimes preset by the Python installer.and the other environment variables are 
  • PYTHONPATH:
    It has a role similar to PATH. This variable tells the Python interpreter where to locate the module files imported into a program. It should include the Python source library directory and the directories containing Python source code. PYTHONPATH is sometimes preset by the Python installer.
  •  PYTHONSTARTUP:
    It contains the path of an initialization file containing Python source code. It is executed every time you start the interpreter. It is named as .pythonrc.py in Unix and it contains commands that load utilities or modify PYTHONPATH.
  •  PYTHONCASEOK:It is used in Windows to instruct Python to find the first case-insensitive match in an import statement. Set this variable to any value to activate it.
  •  PYTHONHOME:It is an alternative module search path. It is usually embedded in the PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy.

                                      RUN PYTHON

The python codes can be run using three ways
  • Interactive Interpreter

    You can start Python from Unix, DOS, or any other system that provides you a command-line interpreter or shell window. 

  • Script from the Command-line

    A Python script can be executed at command line by invoking the interpreter on your application

  • Integrated Development Environment

    You can run Python from a Graphical User Interface (GUI) environment as well, if you have a GUI application on your system that supports Python.

    • Unix − IDLE is the very first Unix IDE for Python.
    • Windows − PythonWin is the first Windows interface for Python and is an IDE with a GUI.
    • Macintosh − The Macintosh version of Python along with the IDLE IDE is available from the main website, downloadable as either MacBinary or BinHex'd files.
If you are not able to set up the environment properly, then you can ask in the comment section. Make sure the Python environment is properly set up and working perfectly fine.You can use other IDE like PyCharm,PyDev or Komodo IDE I am using PyCharm

OKAY THANKS FOR VIEWING MY POST . HOPE YOU LIKE THE POST AND DON'T FORGET TO COMMENT,SHARE AND FOLLOW

No comments:

Post a Comment