Unixbhaskar's Blog

Tuesday, March 8, 2011

How to install python related stuff through setuptools of python

In this article I will guide you through a step which might benefit you to get a better grasp of python related stuff.As I was discovering a specific piece of software and come across few thing related to python(recollecting my old day association with ZOPE).So,basically this is called "easy_install", which will help you to install python files and packages to your system.

I am running Debian Sqeeze and not have that specific tool installed on it by default.So I went ahead and installed it first like below:

bhaskar@bhaskar-laptop_13:30:23_Tue Mar 08:~> sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgnomecupsui1.0-1c2a xfonts-scalable xfonts-75dpi libdmx1 xfonts-100dpi libgnomecups1.0-1
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 221 kB of archives.
After this operation, 1,057 kB of additional disk space will be used.
Get:1 squeeze/main python-setuptools all 0.6.14-4 [221 kB]
Fetched 221 kB in 4s (51.7 kB/s)
Selecting previously deselected package python-setuptools.
(Reading database ... 165516 files and directories currently installed.)
Unpacking python-setuptools (from .../python-setuptools_0.6.14-4_all.deb) ...
Setting up python-setuptools (0.6.14-4) ...

So the package name is python-setuptools , once is installed it will install the "easy_install" thing in your system.Now I have some file to be inflated in my system which has .egg extension and which can read and understand by python installer.For that I have followed the below steps:

bhaskar@bhaskar-laptop_13:30:51_Tue Mar 08:~> sudo /usr/bin/easy_install cssutils-0.9.7-py2.4.egg
install_dir /usr/local/lib/python2.6/dist-packages/
Processing cssutils-0.9.7-py2.4.egg
creating /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.4.egg
Extracting cssutils-0.9.7-py2.4.egg to /usr/local/lib/python2.6/dist-packages
Adding cssutils 0.9.7 to easy-install.pth file
Installing csscombine script to /usr/local/bin
Installing cssparse script to /usr/local/bin
Installing csscapture script to /usr/local/bin

Installed /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.4.egg
Processing dependencies for cssutils==0.9.7
Searching for cssutils==0.9.7
Best match: cssutils 0.9.7
Processing cssutils-0.9.7-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.6.egg
Extracting cssutils-0.9.7-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Removing cssutils 0.9.7 from easy-install.pth file
Adding cssutils 0.9.7 to easy-install.pth file
Installing csscombine script to /usr/local/bin
Installing cssparse script to /usr/local/bin
Installing csscapture script to /usr/local/bin

Installed /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.6.egg
Finished processing dependencies for cssutils==0.9.7

Installing pyinotify

This is a module which helps to track file related activity on GNU/Linux system with the help of filesystems inotify modules.Here is how you can installed it:

bhaskar@bhaskar-laptop_14:52:08_Tue Mar 08:~/Downloads/wimleers-fileconveyor-207361c/code> sudo easy_install pyinotify
install_dir /usr/local/lib/python2.6/dist-packages/
Searching for pyinotify
Best match: pyinotify 0.9.1
Processing pyinotify-0.9.1.tar.gz
Running pyinotify-0.9.1/ -q bdist_egg --dist-dir /tmp/easy_install-H4WKcs/pyinotify-0.9.1/egg-dist-tmp-CK1S6N
WARNING: '' not a valid package name; please use only.-separated package names in
zip_safe flag not set; analyzing archive contents...
Adding pyinotify 0.9.1 to easy-install.pth file

Installed /usr/local/lib/python2.6/dist-packages/pyinotify-0.9.1-py2.6.egg
Processing dependencies for pyinotify
Finished processing dependencies for pyinotify

So you can see in the above output that how easy_install works.Like the way gem work for ruby.

Hope this will help.


No comments:

Post a Comment