Python and pizza.py

Pizza.py is a post-processing tool package for lammps – a MD package. I downloaded it and unpacked in a local directory. Each time I have to start it with a command like “python -f abs_path/pizza.py” where the abs_path is the absolute path to pizza.py source directory. However this directory is very long on my computer and it’s not a directory recognized by python. I found a convenient way to make the call easier. Just add the abs_path to a system environment variable named “PYTHONPATH” (if you have no such env variable, create it), then to use pizza.py we can start python as usual by typing “python” and then type in “import pizza” (no .py suffix!), then we have all the module defined in pizza at the interactive command line no matter what is your current working directory. PYTHONPATH will be add to the search path for modules if it’s not empty. I also add the abs_path to the PATH system environment variable, which makes I could type “pizza.py -f ***.py” directly in any working directory.
Use PYTHONPATH environment variable to install a python
module without the need of root privilege. For example,
set
PYTHONPATH=/path/to/my/lib/python2.2/site-packages/
and when installing a third party Python module, use
python setup.py install --prefix=/path/to/my
Rapid Environment Editor is a convenient tool to modify the environment variables on Windows. And it’s for free! go here to get it.

December 25th, 2009 at 2:20 pm
I want to quote your post in my blog. It can?
And you et an account on Twitter?
January 12th, 2010 at 11:17 am
Yeah, you are welcome to re-post my articles. Please refer to my blog if you do so! Thanks!