Monday, 1 February 2016

Python on Windows

Hi ya'll,

So in my previous post I wrote about the PyCon Namibia 2016 conference that took part from 25 - 29 January 2016.

I had some people actually send me e-mails asking on how to install Python on Windows. And this post will give a short way to install and start using Python on Windows.

The following steps assume that you have internet access on your laptop and that you have administrative privileges on the computer you wish to install Python on.

Additionally it also assumes that you know a little about basic systems administration on Windows or at the very least a power user.

LEGO!!

FYI: This only works for Windows 7 and newer versions

To install Python on Windows:

  1. Go to The Python.org website under Downloads and Download the Windows executable installation file 
  2. Get the 2.7.x version although there are developers that are trying to push for the 3.x versions, I still feel that the latest version might not be as stable (then again me likes 2.7)
  3. Once the download is complete:
    • Double click on the executable file to install
    • Make sure to acknowledge the Windows security prompt
    • Go through the wizard leaving all settings to their defaults
    • Once installation is complete, click finish
  4. Python is installed on your Windows Operating system.

So now that you have install Python you are wondering how do I do the basic tutorials to learn the language?

Well you need to use the command prompt. To open command prompt:
1. Click on the Windows button on your keyboard and type cmd then press enter, this will open the command prompt Window.
or
2. Press Windows + X, this will display a menu to your left, select command prompt from that menu.

Now that you have the command prompt open type "python" (without the quotation marks).

You will get an error, this is because to command prompt does not have the environmental variable to run python from it.

To solve this and make sure you can use python via command prompt edit the environmental variables, as follows:

  1.  Press Windows + X
  2. Select System
  3. Select Advanced system settings (on your left, under Control Panel Home)
  4. Under the advanced tab, select Environmental Variables (at the very bottom of the system properties window).
  5. If you don't have the path already available, create one else edit the existing one.
  6. To create a new User Variable
    • Click on New
    • Enter a Variable name: "path"
    • Enter the Variable value: "C:\Windows\System32;C:\Python27;C:\Python27\python.exe;C:\Python27\Scripts\;C:\Python27\Lib\site-packages\django\bin;"
Don't mind the "C:\Python27\Lib\site-packages\django\bin;", we will use this in the tutorial to come on getting Django setup.

Now for testing, if you have your command prompt open, close it and open it again.

Type "python", you should get something like >>>; this means that you can start using python again.

I hope this was useful, leave a comment if not or yes.



Laterz,

G!

1 comment:

  1. WOW I really need to update this post or rather just write a completely new guide.

    ReplyDelete