ezoic

Sunday, June 26, 2016

How to practically learn Python starting from zero: chapter one set up environment

Python is a computer programming language. It is concise and not difficult to learn. If you want to learn a programming language well, besides reading tutorials, you need to 1. practice (like some small problems in a book, or some projects) , because doing programming is like finishing a craft project, you can learn it almost only by doing some craft projects yourself. 2. read other ppl's code. You can have one github account and put your code their and read other ppl's code there.

To use Python, one needs to have a platform/ OS.  It can be linux, Mac, windows. My experience is that Linux is better or equal to Mac, and they are both better than windows. Mac itself has a linux  terminal which is a plus.

Why linux is better than Windows for Python?  When you are doing python programming, quite often, you need to install additional packages for your Python. If you do it on windows, it is usually some pain in ass especially when the installing package is not exe file, is a zip file, you need to download the file, put it into a suitable directory and go to cmd window etc. And it sometimes fails. But, if you have a linux system and you finish all the programming on your terminal, to install a python package is just a command line. If you do not have Linux, you can install one using the following method on your PC:

http://easyprog99.blogspot.com/2016/04/one-way-to-install-linux-on-your-pc.html

And then install Python on ubuntu:

http://heliumhq.com/docs/installing_python_2.7.5_on_ubuntu

Then install an editor, emacs, or vim on your ubuntu:

http://askubuntu.com/questions/297170/how-to-install-emacs-24-3-on-ubuntu


I think it will take less than 1 hour.

You can test it by writing a simple Python program:

type 'emacs hello.py' to open a file
type in a hello word program:


print 'Hello World!'

ctrl x, ctrl c to close the file, you will be asked if you need to save the change, type 'y'.

To run it, type 'python hello.py', then 'Hello World' will show on your linux screen



On windows, there are two IDE, I would recommend:

1. Anaconda. you can use Anaconda to install your Python packages.  And run your programming on Anaconda. Otherwise, you will face some pain.

http://easyprog99.blogspot.com/2016/04/how-to-install-python-zip-package-on.html


And under Anaconda, there is an IDE called Spyder. After you install Anaconda, you will see it on your computer. It has such logo:



One advantage of using Anaconda is that it usually won't cause problems when you try to install additional packages on your computer even when the firewall of your computer is on.

2. PyCharm.  PyCharm is an IDE developed by  JetBrains. That company has IDEs for C++, Java etc.


https://www.jetbrains.com/pycharm/download/#section=windows

PyCharm has two versions, professional and community versions. Community version is free. Professional version is not free.  But sometimes when the firewall of your computer is on, it will cause problems when installing additional packages on the PyCharm. 

No comments:

Post a Comment

looking for a man

 I am a mid aged woman. I live in southern california.  I was born in 1980. I do not have any kid. no compliacted dating.  I am looking for ...