Friday, June 1, 2012

Now Hatch that Egg

Easy Install:

Easy install is a python module bundled with setuptools, meant for easy download, installation and management of python packages and distributions.

To install a distribution, we only need to supply the name or URL of the python distribution to easy_install


>>> easy_install mySQLdb

or we could install an egg from a directory on our computer as:

>>> easy_install ~/Downloads/chicken-0.1-py2.7.egg

The same could be used for an sdist inside a tarball as:


>>> easy_install ~/Downloads/mypackage-0.1.tar.gz


The packages are installed in python's site-package directory by default. Although the directory can be specified by the --install-dir.
Similarly, any scripts inside the installed distribution are placed in python default scripts folder unless instructed otherwise by the --script-dir option.

Any packages installed with easy_install are added to the easy_install.pth file in the install directory.

Upgrading a package:

Packages can be upgraded easily with easy_install



>>> easy_install "somePackage==2.1"
or
>>> easy_install "somePackage>2.1"
or we could just add the upgrade option to upgrade to the latest version as:
>>> easy_install --upgrade somePackage

Uninstalling an Egg/Package:

Removing the egg or package is as easy as deleting the egg file/directories and any matching scripts.
However, it is best to remove the package's line from easy_install.pth file. This can be done manually or by running:


>>> easy_install -m packageToRemove


This makes sure that python will not search for package anymore.










No comments:

Post a Comment