Crayon Kingdom A tech, develop and reading blog.

Compile & install 32 bit Python 2.7 on 64 bit CentOS 6.5

You might want to compile a version of Python other than shipped one on your CentOS system. For example, running a Python script using a library that only has a 32bit build. Here are the steps on how to compile & install Python 2.7.12 from source code ... Read more
Posted at 2016-06-27 04:52:56 by Ares Ou

How to check version of Python (both command-line and programmatically)

Sometimes you might want to confirm if your program will run / is running under Python 2.x or 3.x. We have a very simple way to do the stuff. Command Line Method It is really easy to confirm a Python version using the option --version of the ... Read more
Posted at 2016-04-09 18:07:59 by Ares Ou

How to directly run a Python script in a *nix environment

Under Mac or Linux environment, add a comment line at the beginning of the file: #!/usr/bin/env python3 print('hello, world') Make the .py file executable: $ chmod a+x Then, run it by typing: $ ./ You are all set! Read more
Posted at 2016-02-16 07:43:42 by Ares Ou

Difference between "is" keyword and "==" (double equal) in Python

Introduction In Python, you may know there are two basic ways to compare if two variables are the same. The first one is is keyword, the second one is == operator. So what's the difference when we use them to compare something? Let's see the code ... Read more
Posted at 2016-02-16 07:43:42 by Ares Ou