create account

Journey Into The World Of Python - #2 Setting Up The Environment by steemtrainer

View this thread on: hive.blogpeakd.comecency.com
· @steemtrainer · (edited)
$22.69
Journey 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:&nbsp;</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-&gt;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>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 8 others
properties (23)
authorsteemtrainer
permlinkjourney-into-the-world-of-python-2-setting-up-the-environment
categorysteemtrainer
json_metadata{"tags":["steemtrainer","programming","python","technology"],"image":["http://i.imgur.com/Ww10mVt.jpg","http://i.imgur.com/QZE6tMN.jpg","http://i.imgur.com/tquKXjz.jpg","http://i.imgur.com/VNGbub5.jpg","http://i.imgur.com/IPOdYvs.jpg","http://i.imgur.com/DG5h2Ec.jpg","http://i.imgur.com/42Bzzg5.jpg","http://i.imgur.com/qD2xriF.jpg"],"links":["https://steemit.com/steemtrainer/@steemtrainer/journey-into-the-world-of-python-1-course-overview","https://www.python.org/downloads/.","http://loadbalancerblog.com/blog/2015/11/python-35-install","https://atom.io/","https://www.python.org/dev/peps/","https://atom.io/packages/linter-pep8","https://steemit.com/@steemtrainer"]}
created2016-10-15 08:12:24
last_update2016-10-15 08:22:51
depth0
children2
last_payout2016-11-15 16:17:21
cashout_time1969-12-31 23:59:59
total_payout_value17.434 HBD
curator_payout_value5.251 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,280
author_reputation732,013,210,811
root_title"Journey Into The World Of Python - #2 Setting Up The Environment"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,538,824
net_rshares32,853,759,847,779
author_curate_reward""
vote details (72)
@steemitboard ·
Congratulations @steemtrainer! You have received a personal award!

[![](https://steemitimages.com/70x70/http://steemitboard.com/@steemtrainer/birthday2.png)](http://steemitboard.com/@steemtrainer)  2 Years on Steemit
<sub>_Click on the badge to view your Board of Honor._</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/steemitboard-ranking-update-steem-power-followers-and-following-added"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmfRVpHQhLDhnjDtqck8GPv9NPvNKPfMsDaAFDE1D9Er2Z/header_ranking.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/steemitboard-ranking-update-steem-power-followers-and-following-added">SteemitBoard Ranking update - Steem Power, Followers and Following added</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-steemtrainer-20181016t082634000z
categorysteemtrainer
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-10-16 08:26:33
last_update2018-10-16 08:26:33
depth1
children0
last_payout2018-10-23 08:26:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,061
author_reputation38,975,615,169,260
root_title"Journey Into The World Of Python - #2 Setting Up The Environment"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,396,701
net_rshares0
@steemitboard ·
Congratulations @steemtrainer! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@steemtrainer/birthday3.png</td><td>Happy Birthday! - You are on the Steem blockchain for 3 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@steemtrainer) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=steemtrainer)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-steemtrainer-20191014t194023000z
categorysteemtrainer
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-10-14 19:40:24
last_update2019-10-14 19:40:24
depth1
children0
last_payout2019-10-21 19:40:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length636
author_reputation38,975,615,169,260
root_title"Journey Into The World Of Python - #2 Setting Up The Environment"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id91,556,316
net_rshares0