How to run Python egg files directly without installing them?

A python egg is a “a single-file importable distribution format”. Which is typically a python package.

You can import the package in the egg as long as you know it’s name and it’s in your path.

You can execute a package using the “-m” option and the package name.

However, python packages generally do not do anything when executed, and you may get an error. The -c option can be used to run code. (See http://docs.python.org/using/cmdline.html for details on command line options)

> python -m sphinx
sphinx is a package and cannot be directly executed


> python -c "import <package in an egg>; <function>();"



> python -c "import sphinx; print sphinx.package_dir"
C:\Python26\lib\site-packages\sphinx-0.6.1-py2.6.egg\sphinx

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)