Journey Into The World Of Python - #2 Setting Up The Environment
steemtrainer·@steemtrainer·
0.000 HBDJourney Into The World Of Python - #2 Setting Up The Environment
<html> <h1>Introduction</h1> <p>This is the first chapter of the series ‘<strong>Journey Into The World Of Python</strong>’. Before we start our course on Python, it is essential to have a basic environment setup in place for programming.</p> <p>Like I said in my <a href="https://steemit.com/steemtrainer/@steemtrainer/journey-into-the-world-of-python-1-course-overview">previous post</a>, I will be using the Atom editor. You can use any other editor of your choice, as the code that we will write in the later chapters of this course will work across all editors and platforms.</p> <p>I use the Mac OS X Yosemite 10.10.5 for development. If you are a windows or a linux user, you can easily setup the Atom editor like I do on my mac.</p> <h1>Installing Python</h1> <p>The first step, is of course, to download and install the Python from https://www.python.org/downloads/.</p> <p><img src="http://i.imgur.com/Ww10mVt.jpg"/></p> <p>You can get the installer from there. Since, I use a Mac, the downloads page shows me a OS X installer. The installer will be '<em>python-3.5.2-macosx10.6.pkg</em>’.</p> <p>If you are on Windows and unable to properly install the latest version of Python, then you may follow the procedure outlined here: http://loadbalancerblog.com/blog/2015/11/python-35-install</p> <p>Let’s check whether python has been properly installed on your system. For this, load up the Terminal (Command Prompt on Windows) and type in 'python' and press enter.</p> <pre><code>python</code></pre> <p>You will see this:</p> <p><img src="http://i.imgur.com/QZE6tMN.jpg"/></p> <p>I know, you just installed a version of Python 3.5 and your terminal shows version 2.7. This is because you have the version 2 already installed on your system. Mac OS X by default comes with Python.</p> <p>Both Python 2 and Python 3 can exist in the same system. So, to invoke the version 3 of Python, all you have to do is type ‘python3’ instead of ‘python’ in the terminal.</p> <pre><code>python3</code></pre> <p>Now, you will see this:</p> <p><img src="http://i.imgur.com/tquKXjz.jpg"/></p> <p>Close the terminal(Command prompt on Windows).</p> <h1>Installing Atom</h1> <p>Now that you have installed Python, let’s install Atom editor. This is simple to achieve as all you have to do is get the latest version of Atom from the official website: </p> <p>https://atom.io/</p> <p>Atom is free to use so, feel free to download it. It is available for both Mac and Windows.</p> <p>The installation is pretty basic and when done, you can load up Atom.</p> <p>This can be done either from ‘Launchpad’, via Spotlight search or via the Terminal by typing ‘atom’.</p> <pre><code>atom</code></pre> <h1>Installing PEP8</h1> <p>PEP is expanded as <strong>Python Enhancement Proposal</strong>. Here is a quote from the Python official website that gives the best definition for this:</p> <blockquote>This PEP contains the index of all Python Enhancement Proposals, known as PEPs.<br> -https://www.python.org/dev/peps/</blockquote> <p>The PEP8 defines certain guidelines on the coding style. We will adopt this style throughout this course.</p> <p>To install PEP8, type the following in terminal:</p> <pre><code>pip install pep8</code></pre> <p>If the above doesn’t work for you on windows, then you can try this:</p> <pre><code>python -m pip install pep8</code></pre> <p>Here ‘pip’ is a small tool that is installed by Python by default, for installing various Python packages easily.</p> <h1>Installing Linter</h1> <p><strong>Linter</strong> (https://atom.io/packages/linter-pep8) is the atom package we will install next. It will make sure that we are following the PEP8 standard correctly.</p> <p>To install Linter for PEP8, do the following:</p> <p>1. Goto Atom Preferences->Install. You will have a screen as follows:</p> <p><img src="http://i.imgur.com/VNGbub5.jpg"/></p> <p>2. Next, install linter-pep8 as follows:</p> <p><img src="http://i.imgur.com/IPOdYvs.jpg"/></p> <p>Now, Create a new Python file(with extension .py) in Atom editor and write the following:</p> <pre><code>def</code></pre> <p>You will see that Atom is providing suggestions. Press Enter key to take the first suggestion. You will now see this screen:</p> <p><img src="http://i.imgur.com/DG5h2Ec.jpg"/></p> <p>If you click after the word ‘pass’, you will see the PEP8 warning as follows:</p> <p><img src="http://i.imgur.com/42Bzzg5.jpg"/></p> <p>This is the linter-pep8 package that is displaying this warning, so that we stick on to the PEP8 style.</p> <p>The current issue is that there is no newline after the last statement. So, we just press enter key to place the cursor at the beginning of the next line(If you have any tabs or spaces on the next line, then delete them).</p> <p>If everything is okay, you see at the bottom, in green as follows:</p> <p><img src="http://i.imgur.com/qD2xriF.jpg"/></p> <p>This concludes this tutorial on setting up the environment for programming. In the next tutorial, we will start with the actual Python language.</p> <h3>Follow me(<a href="https://steemit.com/@steemtrainer">@steemtrainer</a>) to subscribe to the updates on the course - <em>Journey Into The World Of Python</em>.</h3> <p><em>Image Source: All Images are my personal images hosted on Imgur</em></p> </html>
👍 steemtrainer, ervin-lemark, cryptos, robotev1, robotev2, robotev, alexma3x, comeup, cornerstone, lauritanuseda, nimaletavisa, sewimodemi, bereamor, onysenkovitalik, kebulitoda, lauritayerw, shaka, zolder, aresebel, yggkelvnalkis, merevesizion, netaxemezimi, ecerevez, leposkin, laurawerecez, kratur, umbreta, lauraferetilli, javakesemo, merewqerty, taugistojinn, tulrajaso, biophil, primes, vudojindhurus, finatudagi, asarez, nextgen622, manilos, taron, marojanc, shalkisnerisar, elenag, peskov, malek, subcity, mione, highasfuck, doitvoluntarily, jejujinfarm, gavvet, freelancewriter, ausbitbank, bitcoiner, steemleak, debmund, justtryme90, wang, beerbloke, acquire, anyx, cheetah, thecyclist, laonie9, anonymous, val-b, ned, jaewoocho, asmolokalo, mokluc, manoami, future24,