Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Saturday, August 13, 2011

Install Python Code Coverage in Ubuntu 11.04

Just started to learn using Python on Linux. For me, the most troubling stuffs is to get the program installed over Linux.


Anyhow, these are prerequisites,

  • You have Python installed. Ubuntu comes with Python2.7. But, you can install Python 3.2 following another post 
  • Python Setuptools. If you don't have this, you can install it by 
  • $ sudo apt-get install python-setuptools
    


These are steps to install Python Code Coverage
  1. Download the Python Code Coverage from http://pypi.python.org/pypi/coverage. As of writing, the version is 3.5
  2. extract the tarball to a folder, .e.g. ~/Downloads/coverage-3.5
  3. In Ubuntu, the default python is 2.7. It will install to /usr/local/lib/python2.7/dist-packages/
newgear@ubuntu:~/Downloads/coverage-3.5$ sudo python setup.py install -v

Or, you can do this to install to Python 3.2. It will install to /usr/local/lib/python3.2/dist-packages/

newgear@ubuntu:~/Downloads/coverage-3.5$ sudo python3.2 setup.py install -v

Monday, August 8, 2011

Install Python 3.2 on Ubuntu 11.04

Ubuntu comes with Python 2.7, but I want to try out Python 3.2.x. After some google searches, I cannot just remove Python 2.7 and install 3.2.x, as Ubuntu's other modules requires 2.7


But, you can have Python 3.2.x coexist with Python  2.7. This is how:





Launch Ubuntu Software Center, then search Python 3.2. Select Python 3.2 and install





After that, you can run Python 3.2 in terminal like this


newgear@ubuntu:~$ python3.2
Python 3.2 (r32:88445, Mar 25 2011, 19:28:28) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=2, micro=0, releaselevel='final', serial=0)